~avsej/libmemcached/touch-command

« back to all changes in this revision

Viewing changes to m4/pandora_warnings.m4

  • Committer: Brian Aker
  • Date: 2011-01-11 19:55:33 UTC
  • mfrom: (901.1.4 fix-systemtap)
  • Revision ID: brian@tangent.org-20110111195533-z1rpmuiqh0gfwyi2
Merge in changes from Monty

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
dnl  Copyright (C) 2009 Sun Microsystems
2
 
dnl This file is free software; Sun Microsystems
 
1
dnl  Copyright (C) 2009 Sun Microsystems, Inc.
 
2
dnl This file is free software; Sun Microsystems, Inc.
3
3
dnl gives unlimited permission to copy and/or distribute it,
4
4
dnl with or without modifications, as long as this notice is preserved.
5
5
 
34
34
          [ac_cv_warnings_as_errors=yes],
35
35
          [ac_cv_warnings_as_errors=no]))
36
36
 
 
37
  AC_ARG_ENABLE([gcc-profile-mode],
 
38
      [AS_HELP_STRING([--enable-gcc-profile-mode],
 
39
         [Toggle gcc profile mode @<:@default=off@:>@])],
 
40
      [ac_gcc_profile_mode="$enableval"],
 
41
      [ac_gcc_profile_mode="no"])
 
42
 
37
43
  AC_ARG_ENABLE([profiling],
38
44
      [AS_HELP_STRING([--enable-profiling],
39
45
         [Toggle profiling @<:@default=off@:>@])],
87
93
            F_DIAGNOSTICS_SHOW_OPTION="-fdiagnostics-show-option"
88
94
          ])
89
95
 
90
 
    AC_CACHE_CHECK([whether it is safe to use -Wconversion],
91
 
      [ac_cv_safe_to_use_wconversion_],
 
96
    AC_CACHE_CHECK([whether it is safe to use -floop-parallelize-all],
 
97
      [ac_cv_safe_to_use_floop_parallelize_all_],
92
98
      [save_CFLAGS="$CFLAGS"
93
 
       dnl Use -Werror here instead of ${W_FAIL} so that we don't spew
94
 
       dnl conversion warnings to all the tarball folks
95
 
       CFLAGS="-Wconversion -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}"
 
99
       CFLAGS="-floop-parallelize-all ${AM_CFLAGS} ${CFLAGS}"
96
100
       AC_COMPILE_IFELSE(
97
 
         [AC_LANG_PROGRAM([[
98
 
#include <stdbool.h>
99
 
void foo(bool a)
100
 
{
101
 
  (void)a;
102
 
}
103
 
         ]],[[
104
 
foo(0);
105
 
         ]])],
106
 
         [ac_cv_safe_to_use_wconversion_=yes],
107
 
         [ac_cv_safe_to_use_wconversion_=no])
 
101
         [AC_LANG_PROGRAM([],[])],
 
102
         [ac_cv_safe_to_use_floop_parallelize_all_=yes],
 
103
         [ac_cv_safe_to_use_floop_parallelize_all_=no])
108
104
       CFLAGS="$save_CFLAGS"])
109
105
 
110
 
    AS_IF([test "$ac_cv_safe_to_use_wconversion_" = "yes"],
111
 
      [W_CONVERSION="-Wconversion"
112
 
      AC_CACHE_CHECK([whether it is safe to use -Wconversion with htons],
113
 
        [ac_cv_safe_to_use_Wconversion_],
114
 
        [save_CFLAGS="$CFLAGS"
115
 
         dnl Use -Werror here instead of ${W_FAIL} so that we don't spew
116
 
         dnl conversion warnings to all the tarball folks
117
 
         CFLAGS="-Wconversion -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}"
118
 
         AC_COMPILE_IFELSE(
119
 
           [AC_LANG_PROGRAM(
120
 
             [[
121
 
#include <netinet/in.h>
122
 
             ]],[[
123
 
uint16_t x= htons(80);
124
 
             ]])],
125
 
           [ac_cv_safe_to_use_Wconversion_=yes],
126
 
           [ac_cv_safe_to_use_Wconversion_=no])
127
 
         CFLAGS="$save_CFLAGS"])
128
 
 
129
 
      AS_IF([test "$ac_cv_safe_to_use_Wconversion_" = "no"],
130
 
            [NO_CONVERSION="-Wno-conversion"])
131
 
    ])
 
106
    AS_IF([test "$ac_cv_safe_to_use_floop_parallelize_all_" = "yes"],
 
107
          [
 
108
            F_LOOP_PARALLELIZE_ALL="-floop-parallelize-all"
 
109
          ])
132
110
 
133
111
    NO_STRICT_ALIASING="-fno-strict-aliasing -Wno-strict-aliasing"
134
112
    NO_SHADOW="-Wno-shadow"
135
113
 
136
114
    AS_IF([test "$INTELCC" = "yes"],[
137
115
      m4_if(PW_LESS_WARNINGS,[no],[
138
 
        BASE_WARNINGS="-w1 -Werror -Wcheck -Wformat -Wp64 -Woverloaded-virtual -Wcast-qual"
 
116
        BASE_WARNINGS="-w1 -Werror -Wcheck -Wp64 -Woverloaded-virtual -Wcast-qual -diag-disable 188"
139
117
      ],[
140
 
        BASE_WARNINGS="-w1 -Wcheck -Wformat -Wp64 -Woverloaded-virtual -Wcast-qual -diag-disable 981"
 
118
        dnl 2203 is like old-style-cast
 
119
        dnl 1684 is like strict-aliasing
 
120
        dnl 188 is about using enums as bitfields
 
121
        dnl 1683 is a warning about _EXPLICIT_ casting, which we want
 
122
        BASE_WARNINGS="-w1 -Werror -Wcheck -Wp64 -Woverloaded-virtual -Wcast-qual -diag-disable 188,981,2259,2203,1683,1684"
141
123
      ])
142
124
      CC_WARNINGS="${BASE_WARNINGS}"
143
125
      CXX_WARNINGS="${BASE_WARNINGS}"
 
126
      PROTOSKIP_WARNINGS="-diag-disable 188,981,967,2259,1683,1684,2203"
 
127
      
144
128
    ],[
145
129
      m4_if(PW_LESS_WARNINGS,[no],[
146
 
        BASE_WARNINGS_FULL="-Wformat=2 ${W_CONVERSION} -Wstrict-aliasing"
 
130
        BASE_WARNINGS_FULL="${W_CONVERSION} -Wstrict-aliasing"
147
131
        CC_WARNINGS_FULL="-Wswitch-default -Wswitch-enum -Wwrite-strings"
148
 
        CXX_WARNINGS_FULL="-Wold-style-cast"
 
132
        CXX_WARNINGS_FULL="-Weffc++ -Wold-style-cast"
149
133
        NO_OLD_STYLE_CAST="-Wno-old-style-cast"
150
134
        NO_EFF_CXX="-Wno-effc++"
151
135
      ],[
152
 
        BASE_WARNINGS_FULL="-Wformat ${NO_STRICT_ALIASING}"
 
136
        BASE_WARNINGS_FULL="${NO_STRICT_ALIASING}"
153
137
      ])
154
138
 
155
139
      AS_IF([test "${ac_cv_assert}" = "no"],
169
153
        [ac_cv_safe_to_use_Wextra_=no])
170
154
      CFLAGS="$save_CFLAGS"])
171
155
 
172
 
      BASE_WARNINGS="${W_FAIL} -pedantic -Wall -Wundef -Wshadow ${NO_UNUSED} ${F_DIAGNOSTICS_SHOW_OPTION} ${CFLAG_VISIBILITY} ${BASE_WARNINGS_FULL}"
 
156
      BASE_WARNINGS="${W_FAIL} -pedantic -Wall -Wundef -Wshadow ${NO_UNUSED} ${F_DIAGNOSTICS_SHOW_OPTION} ${F_LOOP_PARALLELIZE_ALL} ${BASE_WARNINGS_FULL}"
173
157
      AS_IF([test "$ac_cv_safe_to_use_Wextra_" = "yes"],
174
158
            [BASE_WARNINGS="${BASE_WARNINGS} -Wextra"],
175
159
            [BASE_WARNINGS="${BASE_WARNINGS} -W"])
176
160
  
 
161
      AC_CACHE_CHECK([whether it is safe to use -Wformat],
 
162
        [ac_cv_safe_to_use_wformat_],
 
163
        [save_CFLAGS="$CFLAGS"
 
164
         dnl Use -Werror here instead of ${W_FAIL} so that we don't spew
 
165
         dnl conversion warnings to all the tarball folks
 
166
         CFLAGS="-Wformat -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}"
 
167
         AC_COMPILE_IFELSE(
 
168
           [AC_LANG_PROGRAM([[
 
169
#include <stdio.h>
 
170
#include <stdint.h>
 
171
#include <inttypes.h>
 
172
void foo();
 
173
void foo()
 
174
{
 
175
  uint64_t test_u= 0;
 
176
  printf("This is a %" PRIu64 "test\n", test_u);
 
177
}
 
178
           ]],[[
 
179
foo();
 
180
           ]])],
 
181
           [ac_cv_safe_to_use_wformat_=yes],
 
182
           [ac_cv_safe_to_use_wformat_=no])
 
183
         CFLAGS="$save_CFLAGS"])
 
184
      AS_IF([test "$ac_cv_safe_to_use_wformat_" = "yes"],[
 
185
        BASE_WARNINGS="${BASE_WARNINGS} -Wformat -Wno-format-nonliteral -Wno-format-security"
 
186
        BASE_WARNINGS_FULL="${BASE_WARNINGS_FULL} -Wformat=2 -Wno-format-nonliteral -Wno-format-security"
 
187
        ],[
 
188
        BASE_WARNINGS="${BASE_WARNINGS} -Wno-format"
 
189
        BASE_WARNINGS_FULL="${BASE_WARNINGS_FULL} -Wno-format"
 
190
      ])
 
191
 
 
192
 
 
193
 
 
194
      AC_CACHE_CHECK([whether it is safe to use -Wconversion],
 
195
        [ac_cv_safe_to_use_wconversion_],
 
196
        [save_CFLAGS="$CFLAGS"
 
197
         dnl Use -Werror here instead of ${W_FAIL} so that we don't spew
 
198
         dnl conversion warnings to all the tarball folks
 
199
         CFLAGS="-Wconversion -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}"
 
200
         AC_COMPILE_IFELSE(
 
201
           [AC_LANG_PROGRAM([[
 
202
#include <stdbool.h>
 
203
void foo(bool a)
 
204
{
 
205
  (void)a;
 
206
}
 
207
           ]],[[
 
208
foo(0);
 
209
           ]])],
 
210
           [ac_cv_safe_to_use_wconversion_=yes],
 
211
           [ac_cv_safe_to_use_wconversion_=no])
 
212
         CFLAGS="$save_CFLAGS"])
 
213
  
 
214
      AS_IF([test "$ac_cv_safe_to_use_wconversion_" = "yes"],
 
215
        [W_CONVERSION="-Wconversion"
 
216
        AC_CACHE_CHECK([whether it is safe to use -Wconversion with htons],
 
217
          [ac_cv_safe_to_use_Wconversion_],
 
218
          [save_CFLAGS="$CFLAGS"
 
219
           dnl Use -Werror here instead of ${W_FAIL} so that we don't spew
 
220
           dnl conversion warnings to all the tarball folks
 
221
           CFLAGS="-Wconversion -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}"
 
222
           AC_COMPILE_IFELSE(
 
223
             [AC_LANG_PROGRAM(
 
224
               [[
 
225
#include <netinet/in.h>
 
226
               ]],[[
 
227
uint16_t x= htons(80);
 
228
               ]])],
 
229
             [ac_cv_safe_to_use_Wconversion_=yes],
 
230
             [ac_cv_safe_to_use_Wconversion_=no])
 
231
           CFLAGS="$save_CFLAGS"])
 
232
  
 
233
        AS_IF([test "$ac_cv_safe_to_use_Wconversion_" = "no"],
 
234
              [NO_CONVERSION="-Wno-conversion"])
 
235
      ])
 
236
 
177
237
      CC_WARNINGS="${BASE_WARNINGS} -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wmissing-declarations -Wcast-align ${CC_WARNINGS_FULL}"
178
238
      CXX_WARNINGS="${BASE_WARNINGS} -Woverloaded-virtual -Wnon-virtual-dtor -Wctor-dtor-privacy -Wno-long-long ${CXX_WARNINGS_FULL}"
179
239
 
196
256
      AS_IF([test "$ac_cv_safe_to_use_Wmissing_declarations_" = "yes"],
197
257
            [CXX_WARNINGS="${CXX_WARNINGS} -Wmissing-declarations"])
198
258
  
 
259
      AC_CACHE_CHECK([whether it is safe to use -Wframe-larger-than],
 
260
        [ac_cv_safe_to_use_Wframe_larger_than_],
 
261
        [AC_LANG_PUSH(C++)
 
262
         save_CXXFLAGS="$CXXFLAGS"
 
263
         CXXFLAGS="-Werror -pedantic -Wframe-larger-than=32768 ${AM_CXXFLAGS}"
 
264
         AC_COMPILE_IFELSE([
 
265
           AC_LANG_PROGRAM(
 
266
           [[
 
267
#include <stdio.h>
 
268
           ]], [[]])
 
269
        ],
 
270
        [ac_cv_safe_to_use_Wframe_larger_than_=yes],
 
271
        [ac_cv_safe_to_use_Wframe_larger_than_=no])
 
272
        CXXFLAGS="$save_CXXFLAGS"
 
273
        AC_LANG_POP()
 
274
      ])
 
275
      AS_IF([test "$ac_cv_safe_to_use_Wframe_larger_than_" = "yes"],
 
276
            [CXX_WARNINGS="${CXX_WARNINGS} -Wframe-larger-than=32768"])
 
277
  
199
278
      AC_CACHE_CHECK([whether it is safe to use -Wlogical-op],
200
279
        [ac_cv_safe_to_use_Wlogical_op_],
201
280
        [save_CFLAGS="$CFLAGS"
292
371
      dnl TODO: Figure out a better way to deal with this:
293
372
      PROTOSKIP_WARNINGS="-Wno-effc++ -Wno-shadow -Wno-missing-braces ${NO_ATTRIBUTES}"
294
373
      NO_WERROR="-Wno-error"
295
 
      INNOBASE_SKIP_WARNINGS="-Wno-shadow -Wno-cast-align"
 
374
      PERMISSIVE_WARNINGS="-Wno-error -Wno-unused-function -fpermissive"
296
375
      AS_IF([test "$host_vendor" = "apple"],[
297
376
        BOOSTSKIP_WARNINGS="-Wno-uninitialized"
298
377
      ])
326
405
 
327
406
 
328
407
    m4_if(PW_LESS_WARNINGS, [no],[
329
 
      CC_WARNINGS_FULL="-erroff=E_INTEGER_OVERFLOW_DETECTED${W_PASTE_RESULT}"
 
408
      CC_WARNINGS_FULL="-erroff=E_STATEMENT_NOT_REACHED,E_INTEGER_OVERFLOW_DETECTED${W_PASTE_RESULT}"
330
409
      CXX_WARNINGS_FULL="-erroff=inllargeuse"
331
410
    ],[
332
 
      CC_WARNINGS_FULL="-erroff=E_ATTRIBUTE_NOT_VAR"
 
411
      CC_WARNINGS_FULL="-erroff=E_ATTRIBUTE_NOT_VAR,E_STATEMENT_NOT_REACHED"
333
412
      CXX_WARNINGS_FULL="-erroff=attrskipunsup,doubunder,reftotemp,inllargeuse,truncwarn1,signextwarn,inllargeint"
334
413
    ])
335
414
 
336
 
    CC_WARNINGS="-v -errtags=yes ${W_FAIL} ${CC_WARNINGS_FULL} ${CFLAG_VISIBILITY}"
337
 
    CXX_WARNINGS="+w +w2 -xwe -xport64 -errtags=yes ${CXX_WARNINGS_FULL} ${W_FAIL} ${CFLAG_VISIBILITY}"
 
415
    CC_WARNINGS="-v -errtags=yes ${W_FAIL} ${CC_WARNINGS_FULL}"
 
416
    CXX_WARNINGS="+w +w2 -xwe -xport64 -errtags=yes ${CXX_WARNINGS_FULL} ${W_FAIL}"
338
417
    PROTOSKIP_WARNINGS="-erroff=attrskipunsup,doubunder,reftotemp,wbadinitl,identexpected,inllargeuse,truncwarn1,signextwarn,partinit,notused,badargtype2w,wbadinit"
339
418
    BOOSTSKIP_WARNINGS="-erroff=attrskipunsup,doubunder,reftotemp,inllargeuse,truncwarn1,signextwarn,inllargeint,hidef,wvarhidenmem"
 
419
    PERMISSIVE_WARNINGS="-erroff=attrskipunsup,doubunder,reftotemp,inllargeuse,truncwarn1,signextwarn,inllargeint,hidef,wvarhidenmem,notused,badargtype2w,wunreachable"
 
420
    INNOBASE_SKIP_WARNINGS="-erroff=attrskipunsup,doubunder,reftotemp,wbadinitl,identexpected,inllargeuse,truncwarn1,signextwarn,partinit,notused,badargtype2w,wbadinit,wunreachable"
340
421
    NO_UNREACHED="-erroff=E_STATEMENT_NOT_REACHED"
341
422
    NO_WERROR="-errwarn=%none"
342
423
 
350
431
  AC_SUBST(NO_EFF_CXX)
351
432
  AC_SUBST(NO_OLD_STYLE_CAST)
352
433
  AC_SUBST(PROTOSKIP_WARNINGS)
 
434
  AC_SUBST(INNOBASE_SKIP_WARNINGS)
353
435
  AC_SUBST(BOOSTSKIP_WARNINGS)
354
 
  AC_SUBST(INNOBASE_SKIP_WARNINGS)
 
436
  AC_SUBST(PERMISSIVE_WARNINGS)
355
437
  AC_SUBST(NO_WERROR)
356
438
  AC_SUBST([GCOV_LIBS])
357
439