Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions libc/include/llvm-libc-types/size_t.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@
#ifndef LLVM_LIBC_TYPES_SIZE_T_H
#define LLVM_LIBC_TYPES_SIZE_T_H

// Since __need_size_t is defined, we get the definition of size_t from the
// standalone C header stddef.h. Also, because __need_size_t is defined,
// including stddef.h will pull only the type size_t and nothing else.
#define __need_size_t
#include <stddef.h>
#undef __need_size_t
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason to move away from getting size_t from stddef?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's cleaner and both clang and gcc provide this type definition, which is used in the stddef.h to define size_t anyway.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and isn't llvm-libc-types supposed to be the set of headers that don't depend on the "host" libc? that was my reasoning for "this makes sense here"... (it's only very recently that bionic moved to clang <stddef.h> rather than its own, for example.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the llvm-libc-types headers aren't supposed to depend on host libc headers, but stddef is supposed to come from the compiler iirc. That being said I'm not opposed to defining our own, but we will need to clean up all the places where stddef is currently included in /src. We'd need to do that anyways so not too big a deal.

typedef __SIZE_TYPE__ size_t;

#endif // LLVM_LIBC_TYPES_SIZE_T_H
2 changes: 1 addition & 1 deletion libc/include/llvm-libc-types/ssize_t.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
#ifndef LLVM_LIBC_TYPES_SSIZE_T_H
#define LLVM_LIBC_TYPES_SSIZE_T_H

typedef __INT64_TYPE__ ssize_t;
typedef __PTRDIFF_TYPE__ ssize_t;

#endif // LLVM_LIBC_TYPES_SSIZE_T_H
Loading