Commit 6fa4bc73 authored by Nils Goroll's avatar Nils Goroll

make gcc happier - avoid warnings where we _know_ we need to ignore them

(unless someone tells me how to do this better (in any practical way))
parent 13626a26
...@@ -74,6 +74,27 @@ ...@@ -74,6 +74,27 @@
#define assert(EX) ((void)0) #define assert(EX) ((void)0)
#endif #endif
/*
* Thanks to Jonathan Wakely for these macros
* http://gcc.gnu.org/ml/gcc-help/2011-01/msg00121.html
*
*/
#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 405
# define GCC_DIAG_DO_PRAGMA(x) _Pragma (#x)
# define GCC_DIAG_PRAGMA(x) GCC_DIAG_DO_PRAGMA(GCC diagnostic x)
# if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406
# define GCC_DIAG_OFF(x) GCC_DIAG_PRAGMA(push) \
GCC_DIAG_PRAGMA(ignored x)
# define GCC_DIAG_ON(x) GCC_DIAG_PRAGMA(pop)
# else
# define GCC_DIAG_OFF(x) GCC_DIAG_PRAGMA(ignored x)
# define GCC_DIAG_ON(x) GCC_DIAG_PRAGMA(warning x)
# endif
#else
# define GCC_DIAG_OFF(x)
# define GCC_DIAG_ON(x)
#endif
/* /*
* work around solaris implementing stat() and lstat() in sys/stat_impl.h * work around solaris implementing stat() and lstat() in sys/stat_impl.h
* on the basis of _xstat() * on the basis of _xstat()
...@@ -142,6 +163,9 @@ static pid_t pid; ...@@ -142,6 +163,9 @@ static pid_t pid;
* init real() function ponters * init real() function ponters
*/ */
void __attribute__ ((constructor)) longpath_init(void); void __attribute__ ((constructor)) longpath_init(void);
GCC_DIAG_OFF("-pedantic")
void __attribute__ ((constructor)) void __attribute__ ((constructor))
longpath_init(void) { longpath_init(void) {
# define FUNCTION(type, name, ...) init_dlsym(real(name), name); # define FUNCTION(type, name, ...) init_dlsym(real(name), name);
...@@ -165,6 +189,8 @@ longpath_init(void) { ...@@ -165,6 +189,8 @@ longpath_init(void) {
#endif /* TRACE */ #endif /* TRACE */
} }
GCC_DIAG_ON("-pedantic")
#ifdef TRACE #ifdef TRACE
#define TRACELEN 1024 #define TRACELEN 1024
#define trace(fmt, ...) do { \ #define trace(fmt, ...) do { \
...@@ -934,6 +960,12 @@ enum temp_kind { ...@@ -934,6 +960,12 @@ enum temp_kind {
#endif #endif
}; };
/*
* this is for the oatl_im call: I don't see how to get around ignoring the
* warning without having an extra version of oatl_im for (char **)
*/
GCC_DIAG_OFF("-Wcast-qual")
/* /*
* return val: * return val:
* -1 or valid fd * -1 or valid fd
...@@ -1108,6 +1140,7 @@ _mkxtempl(char *template, int slen, int flags, enum temp_kind kind) { ...@@ -1108,6 +1140,7 @@ _mkxtempl(char *template, int slen, int flags, enum temp_kind kind) {
close_ifd(ifd); close_ifd(ifd);
return fd; return fd;
} }
GCC_DIAG_ON("-Wcast-qual")
/* /*
* Quote solaris man page: * Quote solaris man page:
...@@ -1385,7 +1418,7 @@ static inline void restore_cwd(int *fd) { ...@@ -1385,7 +1418,7 @@ static inline void restore_cwd(int *fd) {
assert(! "not used"); assert(! "not used");
(void)fd; (void)fd;
} }
void *_dummy1 = chdir_im; int (* _dummy1)(const char *, const char **, int) = chdir_im;
void *_dummy2 = restore_cwd; void (* _dummy2)(int *) = restore_cwd;
#endif /* NEED_CHDIR */ #endif /* NEED_CHDIR */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment