Skip to content

Commit

Permalink
[Build] Define ssize_t for windows build.
Browse files Browse the repository at this point in the history
Move size_t and ssize_t header to runtime/platform/compiler.h.
Define ssize_t for windows as ptrdiff_t.

For #4661

Pull Request resolved: #4859
  • Loading branch information
python3kgae authored Aug 23, 2024
1 parent b157e5f commit 6d29c1d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 0 additions & 1 deletion runtime/core/portable_type/tensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#pragma once

#include <executorch/runtime/platform/compiler.h>
#include <sys/types.h> // TODO(T126923429): Include size_t, ssize_t

#include <executorch/runtime/core/portable_type/tensor_impl.h>

Expand Down
2 changes: 0 additions & 2 deletions runtime/core/portable_type/tensor_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

#pragma once

#include <sys/types.h> // TODO(T126923429): Include size_t, ssize_t

#include <executorch/runtime/core/array_ref.h>
#include <executorch/runtime/core/error.h>
#include <executorch/runtime/core/portable_type/scalar_type.h>
Expand Down
8 changes: 8 additions & 0 deletions runtime/platform/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,14 @@
#endif
#endif // ifndef

// Define size_t and ssize_t.
#ifndef _WIN32
#include <sys/types.h>
#else
#include <stddef.h>
using ssize_t = ptrdiff_t;
#endif

// DEPRECATED: Use the non-underscore-prefixed versions instead.
// TODO(T199005537): Remove these once all users have stopped using them.
#define __ET_DEPRECATED ET_DEPRECATED
Expand Down

0 comments on commit 6d29c1d

Please sign in to comment.