diff options
author | devzero2000 <devzero2000> | 2011-09-05 11:26:39 +0000 |
---|---|---|
committer | devzero2000 <devzero2000> | 2011-09-05 11:26:39 +0000 |
commit | 217bada4e58deff154b285569d584241209b613e (patch) | |
tree | fead6bb6900189c42c84e2101c298f8341f67f43 | |
parent | d9e5032cdf8374f78d832c4127f49c2d728afbee (diff) | |
download | libpopt-217bada4e58deff154b285569d584241209b613e.tar.gz |
merge commit 8396019 from git pull request
https://github.com/devzero2000/POPT/pull/2
"Work around missing format for long long in windows; fix warnings"
by asenm (Matt Arsenault)
-rw-r--r-- | CHANGES | 4 | ||||
-rw-r--r-- | popthelp.c | 2 | ||||
-rw-r--r-- | system.h | 33 | ||||
-rw-r--r-- | test1.c | 4 |
4 files changed, 29 insertions, 14 deletions
@@ -1,4 +1,8 @@ 1.17 -> 2.0: + - devzero2000: merge commit 8396019 from git pull request + https://github.com/devzero2000/POPT/pull/2 + "Work around missing format for long long in windows; fix warnings" + by asenm (Matt Arsenault) - devzero2000: merge commit ea2978d from git pull request https://github.com/devzero2000/POPT/pull/2 "Fix build with MinGW 32/64 + MSVC" by arsenm @@ -265,7 +265,7 @@ assert(le); /* XXX can't happen */ le += sprintf(le, "%ld", arg.longp[0]); break; case POPT_ARG_LONGLONG: - le += sprintf(le, "%lld", arg.longlongp[0]); + le += sprintf(le, "%" LONG_LONG_FORMAT, arg.longlongp[0]); break; case POPT_ARG_FLOAT: { double aDouble = (double) arg.floatp[0]; @@ -7,7 +7,6 @@ #endif - #if defined (__GLIBC__) && defined(__LCLINT__) /*@-declundef@*/ /*@unchecked@*/ @@ -54,10 +53,18 @@ char *alloca (); #include <unistd.h> #endif + +#if !defined(__GNUC__) && !defined(__attribute__) +#define __attribute__(x) +#endif +#define UNUSED(x) x __attribute__((__unused__)) + + #ifdef _MSC_VER # define inline __inline #endif + #if defined(_MSC_VER) || defined(__MINGW32__) #define _CRT_SECURE_NO_WARNINGS 1 #include <io.h> @@ -73,6 +80,10 @@ char *alloca (); #define S_ISGID 00020000 #define S_ISVTX 00010000 +/* I haven't discovered a better way to work around these format + specifier problems */ +#define LONG_LONG_FORMAT "I64d" + /* CHECKME */ #define S_IWGRP 00000020 @@ -112,17 +123,22 @@ typedef int ssize_t; #define lseek _lseek /* Pretend to be root to replace these */ -static inline int setuid(int x) { return 1; } +static inline int setuid(UNUSED(int x)) { return 1; } static inline int getuid(void) { return 0; } -static inline int seteuid(int x) { return 1; } +static inline int seteuid(UNUSED(int x)) { return 1; } static inline int geteuid(void) { return 0; } -static inline int setgid(int x) { return 1; } +static inline int setgid(UNUSED(int x)) { return 1; } static inline int getgid(void) { return 0; } -static inline int setegid(int x) { return 1; } +static inline int setegid(UNUSED(int x)) { return 1; } + + +#else + +#define LONG_LONG_FORMAT "lld" #endif /* defined(_MSC_VER) || defined(__MINGW32__) */ @@ -186,12 +202,7 @@ static inline char * stpcpy (char *dest, const char * src) { #define getenv(_s) __secure_getenv(_s) #endif -#if !defined(__GNUC__) && !defined(__attribute__) -#define __attribute__(x) -#endif -#define UNUSED(x) x __attribute__((__unused__)) - /* Include configmake.h autogenerated from Makefile.am */ - #include "configmake.h" #include "popt.h" + @@ -91,7 +91,7 @@ static char * lStr = "123456789+123456789+123456789+123456789+123456789+ " "123456789+123456789+123456789+123456789+123456789+ "; /*@unchecked@*/ /*@null@*/ -static char * nStr = NULL; +static char * nStr = NULL; /*@unchecked@*/ static struct poptOption moreCallbackArgs[] = { @@ -334,7 +334,7 @@ int main(int argc, const char ** argv) if (aLong != bLong) fprintf(stdout, " aLong: %ld", aLong); if (aLongLong != bLongLong) - fprintf(stdout, " aLongLong: %lld", aLongLong); + fprintf(stdout, " aLongLong: %" LONG_LONG_FORMAT, aLongLong); /*@-realcompare@*/ if (aFloat != bFloat) fprintf(stdout, " aFloat: %g", (double)aFloat); |