Mercurial > hg > toybox
annotate lib/portability.h @ 702:9fb5fe6eb13f
More touch cleanup to use generic infrastructure: use getdate() from libc, use flag macros, option parsing can collect argument strings in global block, use existing perror_* macros.
author | Rob Landley <rob@landley.net> |
---|---|
date | Fri, 16 Nov 2012 18:01:35 -0600 |
parents | 8871e8002812 |
children | ff8a27d3ab8f |
rev | line source |
---|---|
691
8871e8002812
Older versions of glibc predated posix-2008. They still provide most of what we need, but require a boot to the headers to get them to admit it. Note that uClibc lies and claims to be glibc so we have to specifically exclude it here.
Rob Landley <rob@landley.net>
parents:
600
diff
changeset
|
1 // Workarounds for horrible build environment idiosyncrasies. |
8871e8002812
Older versions of glibc predated posix-2008. They still provide most of what we need, but require a boot to the headers to get them to admit it. Note that uClibc lies and claims to be glibc so we have to specifically exclude it here.
Rob Landley <rob@landley.net>
parents:
600
diff
changeset
|
2 // Instead of polluting the code with strange #ifdefs to work around bugs |
8871e8002812
Older versions of glibc predated posix-2008. They still provide most of what we need, but require a boot to the headers to get them to admit it. Note that uClibc lies and claims to be glibc so we have to specifically exclude it here.
Rob Landley <rob@landley.net>
parents:
600
diff
changeset
|
3 // in specific compiler, library, or OS versions, localize all that here |
8871e8002812
Older versions of glibc predated posix-2008. They still provide most of what we need, but require a boot to the headers to get them to admit it. Note that uClibc lies and claims to be glibc so we have to specifically exclude it here.
Rob Landley <rob@landley.net>
parents:
600
diff
changeset
|
4 // and in portability.c |
8871e8002812
Older versions of glibc predated posix-2008. They still provide most of what we need, but require a boot to the headers to get them to admit it. Note that uClibc lies and claims to be glibc so we have to specifically exclude it here.
Rob Landley <rob@landley.net>
parents:
600
diff
changeset
|
5 |
372
9051cb744d0a
Shut up even MORE gcc/glibc spurious warnings.
Rob Landley <rob@landley.net>
parents:
166
diff
changeset
|
6 // The tendency of gcc to produce stupid warnings continues with |
549
1f5bd8c93093
Implement Apple and Android versions of getline(), getdelim(), and clearenv().
Georgi Chorbadzhiyski <gf@unixsol.org>
parents:
533
diff
changeset
|
7 // warn_unused_result, which warns about things like ignoring the return code |
372
9051cb744d0a
Shut up even MORE gcc/glibc spurious warnings.
Rob Landley <rob@landley.net>
parents:
166
diff
changeset
|
8 // of nice(2) (which is completely useless since -1 is a legitimate return |
9051cb744d0a
Shut up even MORE gcc/glibc spurious warnings.
Rob Landley <rob@landley.net>
parents:
166
diff
changeset
|
9 // value on success and even the man page tells you to use errno instead). |
9051cb744d0a
Shut up even MORE gcc/glibc spurious warnings.
Rob Landley <rob@landley.net>
parents:
166
diff
changeset
|
10 |
9051cb744d0a
Shut up even MORE gcc/glibc spurious warnings.
Rob Landley <rob@landley.net>
parents:
166
diff
changeset
|
11 // This makes it stop. |
9051cb744d0a
Shut up even MORE gcc/glibc spurious warnings.
Rob Landley <rob@landley.net>
parents:
166
diff
changeset
|
12 |
9051cb744d0a
Shut up even MORE gcc/glibc spurious warnings.
Rob Landley <rob@landley.net>
parents:
166
diff
changeset
|
13 #undef _FORTIFY_SOURCE |
9051cb744d0a
Shut up even MORE gcc/glibc spurious warnings.
Rob Landley <rob@landley.net>
parents:
166
diff
changeset
|
14 |
691
8871e8002812
Older versions of glibc predated posix-2008. They still provide most of what we need, but require a boot to the headers to get them to admit it. Note that uClibc lies and claims to be glibc so we have to specifically exclude it here.
Rob Landley <rob@landley.net>
parents:
600
diff
changeset
|
15 // Always use long file support. |
533 | 16 #define _FILE_OFFSET_BITS 64 |
17 | |
600
58d2fd7484bd
More header fiddling: crypt.h is silly, SUSv4 requires crypt() to be prototyped in unistd.h. The fact glibc refuses to do so without a wacky #define is a glibc bug, treat it as such.
Rob Landley <rob@landley.net>
parents:
550
diff
changeset
|
18 // This isn't in the spec, but it's how we determine what we're using. |
550
b2194045c40e
Remove "feature test macros", replace non-portable fdprintf() with standard fprintf().
Rob Landley <rob@landley.net>
parents:
549
diff
changeset
|
19 |
600
58d2fd7484bd
More header fiddling: crypt.h is silly, SUSv4 requires crypt() to be prototyped in unistd.h. The fact glibc refuses to do so without a wacky #define is a glibc bug, treat it as such.
Rob Landley <rob@landley.net>
parents:
550
diff
changeset
|
20 #include <features.h> |
550
b2194045c40e
Remove "feature test macros", replace non-portable fdprintf() with standard fprintf().
Rob Landley <rob@landley.net>
parents:
549
diff
changeset
|
21 |
b2194045c40e
Remove "feature test macros", replace non-portable fdprintf() with standard fprintf().
Rob Landley <rob@landley.net>
parents:
549
diff
changeset
|
22 #ifdef __GLIBC__ |
b2194045c40e
Remove "feature test macros", replace non-portable fdprintf() with standard fprintf().
Rob Landley <rob@landley.net>
parents:
549
diff
changeset
|
23 // An SUSv4 function that glibc refuses to #define without crazy #defines, |
b2194045c40e
Remove "feature test macros", replace non-portable fdprintf() with standard fprintf().
Rob Landley <rob@landley.net>
parents:
549
diff
changeset
|
24 // see http://pubs.opengroup.org/onlinepubs/9699919799/functions/strptime.html |
b2194045c40e
Remove "feature test macros", replace non-portable fdprintf() with standard fprintf().
Rob Landley <rob@landley.net>
parents:
549
diff
changeset
|
25 #include <time.h> |
b2194045c40e
Remove "feature test macros", replace non-portable fdprintf() with standard fprintf().
Rob Landley <rob@landley.net>
parents:
549
diff
changeset
|
26 char *strptime(const char *buf, const char *format, struct tm *tm); |
600
58d2fd7484bd
More header fiddling: crypt.h is silly, SUSv4 requires crypt() to be prototyped in unistd.h. The fact glibc refuses to do so without a wacky #define is a glibc bug, treat it as such.
Rob Landley <rob@landley.net>
parents:
550
diff
changeset
|
27 // Another one. "Function prototypes shall be provided." but aren't. |
58d2fd7484bd
More header fiddling: crypt.h is silly, SUSv4 requires crypt() to be prototyped in unistd.h. The fact glibc refuses to do so without a wacky #define is a glibc bug, treat it as such.
Rob Landley <rob@landley.net>
parents:
550
diff
changeset
|
28 // http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html |
58d2fd7484bd
More header fiddling: crypt.h is silly, SUSv4 requires crypt() to be prototyped in unistd.h. The fact glibc refuses to do so without a wacky #define is a glibc bug, treat it as such.
Rob Landley <rob@landley.net>
parents:
550
diff
changeset
|
29 char *crypt(const char *key, const char *salt); |
702
9fb5fe6eb13f
More touch cleanup to use generic infrastructure: use getdate() from libc, use flag macros, option parsing can collect argument strings in global block, use existing perror_* macros.
Rob Landley <rob@landley.net>
parents:
691
diff
changeset
|
30 // And again, from all the way back in posix-2001 |
9fb5fe6eb13f
More touch cleanup to use generic infrastructure: use getdate() from libc, use flag macros, option parsing can collect argument strings in global block, use existing perror_* macros.
Rob Landley <rob@landley.net>
parents:
691
diff
changeset
|
31 struct tm *getdate(const char *string); |
691
8871e8002812
Older versions of glibc predated posix-2008. They still provide most of what we need, but require a boot to the headers to get them to admit it. Note that uClibc lies and claims to be glibc so we have to specifically exclude it here.
Rob Landley <rob@landley.net>
parents:
600
diff
changeset
|
32 |
8871e8002812
Older versions of glibc predated posix-2008. They still provide most of what we need, but require a boot to the headers to get them to admit it. Note that uClibc lies and claims to be glibc so we have to specifically exclude it here.
Rob Landley <rob@landley.net>
parents:
600
diff
changeset
|
33 // When building under obsolete glibc, hold its hand a bit. |
8871e8002812
Older versions of glibc predated posix-2008. They still provide most of what we need, but require a boot to the headers to get them to admit it. Note that uClibc lies and claims to be glibc so we have to specifically exclude it here.
Rob Landley <rob@landley.net>
parents:
600
diff
changeset
|
34 |
8871e8002812
Older versions of glibc predated posix-2008. They still provide most of what we need, but require a boot to the headers to get them to admit it. Note that uClibc lies and claims to be glibc so we have to specifically exclude it here.
Rob Landley <rob@landley.net>
parents:
600
diff
changeset
|
35 #if __GLIBC_MINOR__ < 10 && !defined(__UCLIBC__) |
8871e8002812
Older versions of glibc predated posix-2008. They still provide most of what we need, but require a boot to the headers to get them to admit it. Note that uClibc lies and claims to be glibc so we have to specifically exclude it here.
Rob Landley <rob@landley.net>
parents:
600
diff
changeset
|
36 #define AT_FDCWD -100 |
8871e8002812
Older versions of glibc predated posix-2008. They still provide most of what we need, but require a boot to the headers to get them to admit it. Note that uClibc lies and claims to be glibc so we have to specifically exclude it here.
Rob Landley <rob@landley.net>
parents:
600
diff
changeset
|
37 #define AT_SYMLINK_NOFOLLOW 0x100 |
8871e8002812
Older versions of glibc predated posix-2008. They still provide most of what we need, but require a boot to the headers to get them to admit it. Note that uClibc lies and claims to be glibc so we have to specifically exclude it here.
Rob Landley <rob@landley.net>
parents:
600
diff
changeset
|
38 #define AT_REMOVEDIR 0x200 |
8871e8002812
Older versions of glibc predated posix-2008. They still provide most of what we need, but require a boot to the headers to get them to admit it. Note that uClibc lies and claims to be glibc so we have to specifically exclude it here.
Rob Landley <rob@landley.net>
parents:
600
diff
changeset
|
39 int fstatat(int dirfd, const char *pathname, void *buf, int flags); |
8871e8002812
Older versions of glibc predated posix-2008. They still provide most of what we need, but require a boot to the headers to get them to admit it. Note that uClibc lies and claims to be glibc so we have to specifically exclude it here.
Rob Landley <rob@landley.net>
parents:
600
diff
changeset
|
40 int readlinkat(int dirfd, const char *pathname, char *buf, size_t bufsiz); |
8871e8002812
Older versions of glibc predated posix-2008. They still provide most of what we need, but require a boot to the headers to get them to admit it. Note that uClibc lies and claims to be glibc so we have to specifically exclude it here.
Rob Landley <rob@landley.net>
parents:
600
diff
changeset
|
41 char *stpcpy(char *dest, const char *src); |
8871e8002812
Older versions of glibc predated posix-2008. They still provide most of what we need, but require a boot to the headers to get them to admit it. Note that uClibc lies and claims to be glibc so we have to specifically exclude it here.
Rob Landley <rob@landley.net>
parents:
600
diff
changeset
|
42 #include <sys/stat.h> |
8871e8002812
Older versions of glibc predated posix-2008. They still provide most of what we need, but require a boot to the headers to get them to admit it. Note that uClibc lies and claims to be glibc so we have to specifically exclude it here.
Rob Landley <rob@landley.net>
parents:
600
diff
changeset
|
43 int fchmodat(int dirfd, const char *pathname, mode_t mode, int flags); |
8871e8002812
Older versions of glibc predated posix-2008. They still provide most of what we need, but require a boot to the headers to get them to admit it. Note that uClibc lies and claims to be glibc so we have to specifically exclude it here.
Rob Landley <rob@landley.net>
parents:
600
diff
changeset
|
44 int openat(int dirfd, const char *pathname, int flags, ...); |
8871e8002812
Older versions of glibc predated posix-2008. They still provide most of what we need, but require a boot to the headers to get them to admit it. Note that uClibc lies and claims to be glibc so we have to specifically exclude it here.
Rob Landley <rob@landley.net>
parents:
600
diff
changeset
|
45 #include <dirent.h> |
8871e8002812
Older versions of glibc predated posix-2008. They still provide most of what we need, but require a boot to the headers to get them to admit it. Note that uClibc lies and claims to be glibc so we have to specifically exclude it here.
Rob Landley <rob@landley.net>
parents:
600
diff
changeset
|
46 DIR *fdopendir(int fd); |
8871e8002812
Older versions of glibc predated posix-2008. They still provide most of what we need, but require a boot to the headers to get them to admit it. Note that uClibc lies and claims to be glibc so we have to specifically exclude it here.
Rob Landley <rob@landley.net>
parents:
600
diff
changeset
|
47 #include <unistd.h> |
8871e8002812
Older versions of glibc predated posix-2008. They still provide most of what we need, but require a boot to the headers to get them to admit it. Note that uClibc lies and claims to be glibc so we have to specifically exclude it here.
Rob Landley <rob@landley.net>
parents:
600
diff
changeset
|
48 int fchownat(int dirfd, const char *pathname, |
8871e8002812
Older versions of glibc predated posix-2008. They still provide most of what we need, but require a boot to the headers to get them to admit it. Note that uClibc lies and claims to be glibc so we have to specifically exclude it here.
Rob Landley <rob@landley.net>
parents:
600
diff
changeset
|
49 uid_t owner, gid_t group, int flags); |
8871e8002812
Older versions of glibc predated posix-2008. They still provide most of what we need, but require a boot to the headers to get them to admit it. Note that uClibc lies and claims to be glibc so we have to specifically exclude it here.
Rob Landley <rob@landley.net>
parents:
600
diff
changeset
|
50 int isblank(int c); |
8871e8002812
Older versions of glibc predated posix-2008. They still provide most of what we need, but require a boot to the headers to get them to admit it. Note that uClibc lies and claims to be glibc so we have to specifically exclude it here.
Rob Landley <rob@landley.net>
parents:
600
diff
changeset
|
51 int unlinkat(int dirfd, const char *pathname, int flags); |
8871e8002812
Older versions of glibc predated posix-2008. They still provide most of what we need, but require a boot to the headers to get them to admit it. Note that uClibc lies and claims to be glibc so we have to specifically exclude it here.
Rob Landley <rob@landley.net>
parents:
600
diff
changeset
|
52 #include <stdio.h> |
8871e8002812
Older versions of glibc predated posix-2008. They still provide most of what we need, but require a boot to the headers to get them to admit it. Note that uClibc lies and claims to be glibc so we have to specifically exclude it here.
Rob Landley <rob@landley.net>
parents:
600
diff
changeset
|
53 ssize_t getdelim(char **lineptr, size_t *n, int delim, FILE *stream); |
8871e8002812
Older versions of glibc predated posix-2008. They still provide most of what we need, but require a boot to the headers to get them to admit it. Note that uClibc lies and claims to be glibc so we have to specifically exclude it here.
Rob Landley <rob@landley.net>
parents:
600
diff
changeset
|
54 #endif |
8871e8002812
Older versions of glibc predated posix-2008. They still provide most of what we need, but require a boot to the headers to get them to admit it. Note that uClibc lies and claims to be glibc so we have to specifically exclude it here.
Rob Landley <rob@landley.net>
parents:
600
diff
changeset
|
55 |
550
b2194045c40e
Remove "feature test macros", replace non-portable fdprintf() with standard fprintf().
Rob Landley <rob@landley.net>
parents:
549
diff
changeset
|
56 #endif |
63
69efffcacd70
Add fdprintf(). Remove reread() and rewrite() which handle -EINTR, which
Rob Landley <rob@landley.net>
parents:
53
diff
changeset
|
57 |
166
5f1d3ad8a888
Add noreturn mark to [p]error_exit(), suggested by Charlie Shepherd.
Rob Landley <rob@landley.net>
parents:
100
diff
changeset
|
58 #ifdef __GNUC__ |
5f1d3ad8a888
Add noreturn mark to [p]error_exit(), suggested by Charlie Shepherd.
Rob Landley <rob@landley.net>
parents:
100
diff
changeset
|
59 #define noreturn __attribute__((noreturn)) |
5f1d3ad8a888
Add noreturn mark to [p]error_exit(), suggested by Charlie Shepherd.
Rob Landley <rob@landley.net>
parents:
100
diff
changeset
|
60 #else |
5f1d3ad8a888
Add noreturn mark to [p]error_exit(), suggested by Charlie Shepherd.
Rob Landley <rob@landley.net>
parents:
100
diff
changeset
|
61 #define noreturn |
5f1d3ad8a888
Add noreturn mark to [p]error_exit(), suggested by Charlie Shepherd.
Rob Landley <rob@landley.net>
parents:
100
diff
changeset
|
62 #endif |
100
c3d1d74d5d8f
MacOS X has a defective sed with no -r.
Rob Landley <rob@landley.net>
parents:
94
diff
changeset
|
63 |
c3d1d74d5d8f
MacOS X has a defective sed with no -r.
Rob Landley <rob@landley.net>
parents:
94
diff
changeset
|
64 #ifndef __APPLE__ |
c3d1d74d5d8f
MacOS X has a defective sed with no -r.
Rob Landley <rob@landley.net>
parents:
94
diff
changeset
|
65 #include <byteswap.h> |
53
41d55b5d49fd
Add start of mke2fs/gene2fs, and some other stuff I've been working on.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
66 #include <endian.h> |
41d55b5d49fd
Add start of mke2fs/gene2fs, and some other stuff I've been working on.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
67 |
41d55b5d49fd
Add start of mke2fs/gene2fs, and some other stuff I've been working on.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
68 #if __BYTE_ORDER == __BIG_ENDIAN |
41d55b5d49fd
Add start of mke2fs/gene2fs, and some other stuff I've been working on.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
69 #define IS_BIG_ENDIAN 1 |
100
c3d1d74d5d8f
MacOS X has a defective sed with no -r.
Rob Landley <rob@landley.net>
parents:
94
diff
changeset
|
70 #else |
c3d1d74d5d8f
MacOS X has a defective sed with no -r.
Rob Landley <rob@landley.net>
parents:
94
diff
changeset
|
71 #define IS_BIG_ENDIAN 0 |
c3d1d74d5d8f
MacOS X has a defective sed with no -r.
Rob Landley <rob@landley.net>
parents:
94
diff
changeset
|
72 #endif |
c3d1d74d5d8f
MacOS X has a defective sed with no -r.
Rob Landley <rob@landley.net>
parents:
94
diff
changeset
|
73 |
549
1f5bd8c93093
Implement Apple and Android versions of getline(), getdelim(), and clearenv().
Georgi Chorbadzhiyski <gf@unixsol.org>
parents:
533
diff
changeset
|
74 int clearenv(void); |
100
c3d1d74d5d8f
MacOS X has a defective sed with no -r.
Rob Landley <rob@landley.net>
parents:
94
diff
changeset
|
75 #else |
c3d1d74d5d8f
MacOS X has a defective sed with no -r.
Rob Landley <rob@landley.net>
parents:
94
diff
changeset
|
76 |
c3d1d74d5d8f
MacOS X has a defective sed with no -r.
Rob Landley <rob@landley.net>
parents:
94
diff
changeset
|
77 #ifdef __BIG_ENDIAN__ |
c3d1d74d5d8f
MacOS X has a defective sed with no -r.
Rob Landley <rob@landley.net>
parents:
94
diff
changeset
|
78 #define IS_BIG_ENDIAN 1 |
c3d1d74d5d8f
MacOS X has a defective sed with no -r.
Rob Landley <rob@landley.net>
parents:
94
diff
changeset
|
79 #else |
c3d1d74d5d8f
MacOS X has a defective sed with no -r.
Rob Landley <rob@landley.net>
parents:
94
diff
changeset
|
80 #define IS_BIG_ENDIAN 0 |
c3d1d74d5d8f
MacOS X has a defective sed with no -r.
Rob Landley <rob@landley.net>
parents:
94
diff
changeset
|
81 #endif |
c3d1d74d5d8f
MacOS X has a defective sed with no -r.
Rob Landley <rob@landley.net>
parents:
94
diff
changeset
|
82 |
c3d1d74d5d8f
MacOS X has a defective sed with no -r.
Rob Landley <rob@landley.net>
parents:
94
diff
changeset
|
83 #endif |
c3d1d74d5d8f
MacOS X has a defective sed with no -r.
Rob Landley <rob@landley.net>
parents:
94
diff
changeset
|
84 |
c3d1d74d5d8f
MacOS X has a defective sed with no -r.
Rob Landley <rob@landley.net>
parents:
94
diff
changeset
|
85 #if IS_BIG_ENDIAN |
53
41d55b5d49fd
Add start of mke2fs/gene2fs, and some other stuff I've been working on.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
86 #define IS_LITTLE_ENDIAN 0 |
41d55b5d49fd
Add start of mke2fs/gene2fs, and some other stuff I've been working on.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
87 #define SWAP_BE16(x) (x) |
41d55b5d49fd
Add start of mke2fs/gene2fs, and some other stuff I've been working on.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
88 #define SWAP_BE32(x) (x) |
41d55b5d49fd
Add start of mke2fs/gene2fs, and some other stuff I've been working on.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
89 #define SWAP_BE64(x) (x) |
41d55b5d49fd
Add start of mke2fs/gene2fs, and some other stuff I've been working on.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
90 #define SWAP_LE16(x) bswap_16(x) |
41d55b5d49fd
Add start of mke2fs/gene2fs, and some other stuff I've been working on.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
91 #define SWAP_LE32(x) bswap_32(x) |
41d55b5d49fd
Add start of mke2fs/gene2fs, and some other stuff I've been working on.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
92 #define SWAP_LE64(x) bswap_64(x) |
41d55b5d49fd
Add start of mke2fs/gene2fs, and some other stuff I've been working on.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
93 #else |
41d55b5d49fd
Add start of mke2fs/gene2fs, and some other stuff I've been working on.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
94 #define IS_LITTLE_ENDIAN 1 |
41d55b5d49fd
Add start of mke2fs/gene2fs, and some other stuff I've been working on.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
95 #define SWAP_BE16(x) bswap_16(x) |
41d55b5d49fd
Add start of mke2fs/gene2fs, and some other stuff I've been working on.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
96 #define SWAP_BE32(x) bswap_32(x) |
41d55b5d49fd
Add start of mke2fs/gene2fs, and some other stuff I've been working on.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
97 #define SWAP_BE64(x) bswap_64(x) |
41d55b5d49fd
Add start of mke2fs/gene2fs, and some other stuff I've been working on.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
98 #define SWAP_LE16(x) (x) |
41d55b5d49fd
Add start of mke2fs/gene2fs, and some other stuff I've been working on.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
99 #define SWAP_LE32(x) (x) |
41d55b5d49fd
Add start of mke2fs/gene2fs, and some other stuff I've been working on.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
100 #define SWAP_LE64(x) (x) |
41d55b5d49fd
Add start of mke2fs/gene2fs, and some other stuff I've been working on.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
101 #endif |
94
884c03c29f21
Teach build to build only the toys/*.c selected in .config, and teach
Rob Landley <rob@landley.net>
parents:
63
diff
changeset
|
102 |
884c03c29f21
Teach build to build only the toys/*.c selected in .config, and teach
Rob Landley <rob@landley.net>
parents:
63
diff
changeset
|
103 // Some versions of gcc produce spurious "may be uninitialized" warnings in |
884c03c29f21
Teach build to build only the toys/*.c selected in .config, and teach
Rob Landley <rob@landley.net>
parents:
63
diff
changeset
|
104 // cases where it provably can't happen. Unfortunately, although this warning |
884c03c29f21
Teach build to build only the toys/*.c selected in .config, and teach
Rob Landley <rob@landley.net>
parents:
63
diff
changeset
|
105 // is calculated and produced separately from the "is definitely used |
884c03c29f21
Teach build to build only the toys/*.c selected in .config, and teach
Rob Landley <rob@landley.net>
parents:
63
diff
changeset
|
106 // uninitialized" warnings, there's no way to turn off the broken spurious "may |
884c03c29f21
Teach build to build only the toys/*.c selected in .config, and teach
Rob Landley <rob@landley.net>
parents:
63
diff
changeset
|
107 // be" warnings without also turning off the non-broken "is" warnings. |
884c03c29f21
Teach build to build only the toys/*.c selected in .config, and teach
Rob Landley <rob@landley.net>
parents:
63
diff
changeset
|
108 |
884c03c29f21
Teach build to build only the toys/*.c selected in .config, and teach
Rob Landley <rob@landley.net>
parents:
63
diff
changeset
|
109 #if CFG_TOYBOX_DEBUG |
884c03c29f21
Teach build to build only the toys/*.c selected in .config, and teach
Rob Landley <rob@landley.net>
parents:
63
diff
changeset
|
110 #define GCC_BUG =0 |
884c03c29f21
Teach build to build only the toys/*.c selected in .config, and teach
Rob Landley <rob@landley.net>
parents:
63
diff
changeset
|
111 #else |
884c03c29f21
Teach build to build only the toys/*.c selected in .config, and teach
Rob Landley <rob@landley.net>
parents:
63
diff
changeset
|
112 #define GCC_BUG |
884c03c29f21
Teach build to build only the toys/*.c selected in .config, and teach
Rob Landley <rob@landley.net>
parents:
63
diff
changeset
|
113 #endif |
549
1f5bd8c93093
Implement Apple and Android versions of getline(), getdelim(), and clearenv().
Georgi Chorbadzhiyski <gf@unixsol.org>
parents:
533
diff
changeset
|
114 |
1f5bd8c93093
Implement Apple and Android versions of getline(), getdelim(), and clearenv().
Georgi Chorbadzhiyski <gf@unixsol.org>
parents:
533
diff
changeset
|
115 #if defined(__APPLE__) || defined(__ANDROID__) |
1f5bd8c93093
Implement Apple and Android versions of getline(), getdelim(), and clearenv().
Georgi Chorbadzhiyski <gf@unixsol.org>
parents:
533
diff
changeset
|
116 ssize_t getdelim(char **lineptr, size_t *n, int delim, FILE *stream); |
1f5bd8c93093
Implement Apple and Android versions of getline(), getdelim(), and clearenv().
Georgi Chorbadzhiyski <gf@unixsol.org>
parents:
533
diff
changeset
|
117 ssize_t getline(char **lineptr, size_t *n, FILE *stream); |
1f5bd8c93093
Implement Apple and Android versions of getline(), getdelim(), and clearenv().
Georgi Chorbadzhiyski <gf@unixsol.org>
parents:
533
diff
changeset
|
118 #endif |