diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2002-02-20 18:11:05 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2002-02-20 18:11:05 +0000 |
commit | b147ee3f085f1217d0db6c547e0dd0a009326d49 (patch) | |
tree | 54426f8df735c69867d277ac21a7eca41883f74e /include | |
parent | bd5548f7ff0a48b0b4d8c8c5acc2d4dc39bcccce (diff) |
Some user header files may define an abs macro which will cause a
syntax error if the #define happens before stdlib.h is included.
If abs is #defined, #undef and issue a warning. This is similar
to what Tru64 UNIX does and is effectively the same as what happens
on Solaris (though on Solaris the real abs() is a macro).
Diffstat (limited to 'include')
-rw-r--r-- | include/stdlib.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/include/stdlib.h b/include/stdlib.h index b5b558eedce..8bf2d37fc7f 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -1,4 +1,4 @@ -/* $OpenBSD: stdlib.h,v 1.17 2002/02/17 19:42:21 millert Exp $ */ +/* $OpenBSD: stdlib.h,v 1.18 2002/02/20 18:11:04 millert Exp $ */ /* $NetBSD: stdlib.h,v 1.25 1995/12/27 21:19:08 jtc Exp $ */ /*- @@ -92,6 +92,15 @@ typedef struct { #include <sys/cdefs.h> +/* + * Some header files may define an abs macro. + * If defined, undef it to prevent a syntax error and issue a warning. + */ +#ifdef abs +#undef abs +#warning abs macro collides with abs() prototype, undefining +#endif + __BEGIN_DECLS __dead void abort(void); int abs(int); @@ -116,8 +125,12 @@ void *realloc(void *, size_t); void srand(unsigned); double strtod(const char *, char **); long strtol(const char *, char **, int); +long long + strtoll(const char *, char **, int); unsigned long strtoul(const char *, char **, int); +unsigned long long + strtoull(const char *, char **, int); int system(const char *); /* these are currently just stubs */ @@ -156,6 +169,8 @@ char *l64a(long); void cfree(void *); +#ifndef _GETOPT_DEFINED_ +#define _GETOPT_DEFINED_ int getopt(int, char * const *, const char *); extern char *optarg; /* getopt(3) external variables */ extern int opterr; @@ -164,6 +179,7 @@ extern int optopt; extern int optreset; int getsubopt(char **, char * const *, char **); extern char *suboptarg; /* getsubopt(3) external variable */ +#endif /* _GETOPT_DEFINED_ */ int heapsort(void *, size_t, size_t, int (*)(const void *, const void *)); int mergesort(void *, size_t, size_t, int (*)(const void *, const void *)); |