~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to m4/pandora_warnings.m4

  • Committer: Monty Taylor
  • Date: 2010-11-26 22:50:54 UTC
  • mfrom: (1953.1.6 build)
  • Revision ID: mordred@inaugust.com-20101126225054-sg90svw8579t5p3i
Stewart - InnoDB 1.1.1
Monty - Fixed some autoconf tests which were returning false positives.

Show diffs side-by-side

added added

removed removed

Lines of Context:
87
87
            F_DIAGNOSTICS_SHOW_OPTION="-fdiagnostics-show-option"
88
88
          ])
89
89
 
90
 
    AC_CACHE_CHECK([whether it is safe to use -Wformat],
91
 
      [ac_cv_safe_to_use_wformat_],
92
 
      [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}"
96
 
       AC_COMPILE_IFELSE(
97
 
         [AC_LANG_PROGRAM([[
98
 
#include <stdio.h>
99
 
#include <stdint.h>
100
 
#include <inttypes.h>
101
 
void foo(bool a)
102
 
{
103
 
  uint64_t test_u= 0;
104
 
  printf("This is a %" PRIu64 "test\n", test_u);
105
 
}
106
 
         ]],[[
107
 
foo(0);
108
 
         ]])],
109
 
         [ac_cv_safe_to_use_wformat_=yes],
110
 
         [ac_cv_safe_to_use_wformat_=no])
111
 
       CFLAGS="$save_CFLAGS"])
112
 
    AS_IF([test "$ac_cv_safe_to_use_wformat_" = "yes"],[
113
 
      W_FORMAT="-Wformat"
114
 
      W_FORMAT_2="-Wformat=2"
115
 
      NO_FORMAT="-Wno-format"
116
 
      ],[
117
 
      W_FORMAT="-Wno-format"
118
 
      W_FORMAT_2="-Wno-format"
119
 
      NO_FORMAT="-Wno-format"
120
 
    ])
121
 
 
122
 
 
123
 
 
124
 
    AC_CACHE_CHECK([whether it is safe to use -Wconversion],
125
 
      [ac_cv_safe_to_use_wconversion_],
126
 
      [save_CFLAGS="$CFLAGS"
127
 
       dnl Use -Werror here instead of ${W_FAIL} so that we don't spew
128
 
       dnl conversion warnings to all the tarball folks
129
 
       CFLAGS="-Wconversion -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}"
130
 
       AC_COMPILE_IFELSE(
131
 
         [AC_LANG_PROGRAM([[
132
 
#include <stdbool.h>
133
 
void foo(bool a)
134
 
{
135
 
  (void)a;
136
 
}
137
 
         ]],[[
138
 
foo(0);
139
 
         ]])],
140
 
         [ac_cv_safe_to_use_wconversion_=yes],
141
 
         [ac_cv_safe_to_use_wconversion_=no])
142
 
       CFLAGS="$save_CFLAGS"])
143
 
 
144
 
    AS_IF([test "$ac_cv_safe_to_use_wconversion_" = "yes"],
145
 
      [W_CONVERSION="-Wconversion"
146
 
      AC_CACHE_CHECK([whether it is safe to use -Wconversion with htons],
147
 
        [ac_cv_safe_to_use_Wconversion_],
148
 
        [save_CFLAGS="$CFLAGS"
149
 
         dnl Use -Werror here instead of ${W_FAIL} so that we don't spew
150
 
         dnl conversion warnings to all the tarball folks
151
 
         CFLAGS="-Wconversion -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}"
152
 
         AC_COMPILE_IFELSE(
153
 
           [AC_LANG_PROGRAM(
154
 
             [[
155
 
#include <netinet/in.h>
156
 
             ]],[[
157
 
uint16_t x= htons(80);
158
 
             ]])],
159
 
           [ac_cv_safe_to_use_Wconversion_=yes],
160
 
           [ac_cv_safe_to_use_Wconversion_=no])
161
 
         CFLAGS="$save_CFLAGS"])
162
 
 
163
 
      AS_IF([test "$ac_cv_safe_to_use_Wconversion_" = "no"],
164
 
            [NO_CONVERSION="-Wno-conversion"])
165
 
    ])
166
 
 
167
90
    NO_STRICT_ALIASING="-fno-strict-aliasing -Wno-strict-aliasing"
168
91
    NO_SHADOW="-Wno-shadow"
169
92
 
170
93
    AS_IF([test "$INTELCC" = "yes"],[
171
94
      m4_if(PW_LESS_WARNINGS,[no],[
172
 
        BASE_WARNINGS="-w1 -Werror -Wcheck ${W_FORMAT} -Wp64 -Woverloaded-virtual -Wcast-qual -diag-disable 188"
 
95
        BASE_WARNINGS="-w1 -Werror -Wcheck -Wp64 -Woverloaded-virtual -Wcast-qual -diag-disable 188"
173
96
      ],[
174
97
        dnl 2203 is like old-style-cast
175
98
        dnl 1684 is like strict-aliasing
176
99
        dnl 188 is about using enums as bitfields
177
100
        dnl 1683 is a warning about _EXPLICIT_ casting, which we want
178
 
        BASE_WARNINGS="-w1 -Werror -Wcheck ${W_FORMAT} -Wp64 -Woverloaded-virtual -Wcast-qual -diag-disable 188,981,2259,2203,1683,1684"
 
101
        BASE_WARNINGS="-w1 -Werror -Wcheck -Wp64 -Woverloaded-virtual -Wcast-qual -diag-disable 188,981,2259,2203,1683,1684"
179
102
      ])
180
103
      CC_WARNINGS="${BASE_WARNINGS}"
181
104
      CXX_WARNINGS="${BASE_WARNINGS}"
183
106
      
184
107
    ],[
185
108
      m4_if(PW_LESS_WARNINGS,[no],[
186
 
        BASE_WARNINGS_FULL="${W_FORMAT_2} ${W_CONVERSION} -Wstrict-aliasing"
 
109
        BASE_WARNINGS_FULL="${W_CONVERSION} -Wstrict-aliasing"
187
110
        CC_WARNINGS_FULL="-Wswitch-default -Wswitch-enum -Wwrite-strings"
188
111
        CXX_WARNINGS_FULL="-Weffc++ -Wold-style-cast"
189
112
        NO_OLD_STYLE_CAST="-Wno-old-style-cast"
190
113
        NO_EFF_CXX="-Wno-effc++"
191
114
      ],[
192
 
        BASE_WARNINGS_FULL="${W_FORMAT_2} ${NO_STRICT_ALIASING}"
 
115
        BASE_WARNINGS_FULL="${NO_STRICT_ALIASING}"
193
116
      ])
194
117
 
195
118
      AS_IF([test "${ac_cv_assert}" = "no"],
214
137
            [BASE_WARNINGS="${BASE_WARNINGS} -Wextra"],
215
138
            [BASE_WARNINGS="${BASE_WARNINGS} -W"])
216
139
  
 
140
      AC_CACHE_CHECK([whether it is safe to use -Wformat],
 
141
        [ac_cv_safe_to_use_wformat_],
 
142
        [save_CFLAGS="$CFLAGS"
 
143
         dnl Use -Werror here instead of ${W_FAIL} so that we don't spew
 
144
         dnl conversion warnings to all the tarball folks
 
145
         CFLAGS="-Wformat -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}"
 
146
         AC_COMPILE_IFELSE(
 
147
           [AC_LANG_PROGRAM([[
 
148
#include <stdio.h>
 
149
#include <stdint.h>
 
150
#include <inttypes.h>
 
151
void foo();
 
152
void foo()
 
153
{
 
154
  uint64_t test_u= 0;
 
155
  printf("This is a %" PRIu64 "test\n", test_u);
 
156
}
 
157
           ]],[[
 
158
foo();
 
159
           ]])],
 
160
           [ac_cv_safe_to_use_wformat_=yes],
 
161
           [ac_cv_safe_to_use_wformat_=no])
 
162
         CFLAGS="$save_CFLAGS"])
 
163
      AS_IF([test "$ac_cv_safe_to_use_wformat_" = "yes"],[
 
164
        BASE_WARNINGS="${BASE_WARNINGS} -Wformat -Wno-format-nonliteral -Wno-format-security"
 
165
        BASE_WARNINGS_FULL="${BASE_WARNINGS_FULL} -Wformat=2 -Wno-format-nonliteral -Wno-format-security"
 
166
        ],[
 
167
        BASE_WARNINGS="${BASE_WARNINGS} -Wno-format"
 
168
        BASE_WARNINGS_FULL="${BASE_WARNINGS_FULL} -Wno-format"
 
169
      ])
 
170
 
 
171
 
 
172
 
 
173
      AC_CACHE_CHECK([whether it is safe to use -Wconversion],
 
174
        [ac_cv_safe_to_use_wconversion_],
 
175
        [save_CFLAGS="$CFLAGS"
 
176
         dnl Use -Werror here instead of ${W_FAIL} so that we don't spew
 
177
         dnl conversion warnings to all the tarball folks
 
178
         CFLAGS="-Wconversion -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}"
 
179
         AC_COMPILE_IFELSE(
 
180
           [AC_LANG_PROGRAM([[
 
181
#include <stdbool.h>
 
182
void foo(bool a)
 
183
{
 
184
  (void)a;
 
185
}
 
186
           ]],[[
 
187
foo(0);
 
188
           ]])],
 
189
           [ac_cv_safe_to_use_wconversion_=yes],
 
190
           [ac_cv_safe_to_use_wconversion_=no])
 
191
         CFLAGS="$save_CFLAGS"])
 
192
  
 
193
      AS_IF([test "$ac_cv_safe_to_use_wconversion_" = "yes"],
 
194
        [W_CONVERSION="-Wconversion"
 
195
        AC_CACHE_CHECK([whether it is safe to use -Wconversion with htons],
 
196
          [ac_cv_safe_to_use_Wconversion_],
 
197
          [save_CFLAGS="$CFLAGS"
 
198
           dnl Use -Werror here instead of ${W_FAIL} so that we don't spew
 
199
           dnl conversion warnings to all the tarball folks
 
200
           CFLAGS="-Wconversion -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}"
 
201
           AC_COMPILE_IFELSE(
 
202
             [AC_LANG_PROGRAM(
 
203
               [[
 
204
#include <netinet/in.h>
 
205
               ]],[[
 
206
uint16_t x= htons(80);
 
207
               ]])],
 
208
             [ac_cv_safe_to_use_Wconversion_=yes],
 
209
             [ac_cv_safe_to_use_Wconversion_=no])
 
210
           CFLAGS="$save_CFLAGS"])
 
211
  
 
212
        AS_IF([test "$ac_cv_safe_to_use_Wconversion_" = "no"],
 
213
              [NO_CONVERSION="-Wno-conversion"])
 
214
      ])
 
215
 
217
216
      CC_WARNINGS="${BASE_WARNINGS} -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wmissing-declarations -Wcast-align ${CC_WARNINGS_FULL}"
218
217
      CXX_WARNINGS="${BASE_WARNINGS} -Woverloaded-virtual -Wnon-virtual-dtor -Wctor-dtor-privacy -Wno-long-long ${CXX_WARNINGS_FULL}"
219
218
 
351
350
      dnl TODO: Figure out a better way to deal with this:
352
351
      PROTOSKIP_WARNINGS="-Wno-effc++ -Wno-shadow -Wno-missing-braces ${NO_ATTRIBUTES}"
353
352
      NO_WERROR="-Wno-error"
354
 
      INNOBASE_SKIP_WARNINGS="-Wno-shadow -Wno-cast-align -Wno-strict-prototypes"
 
353
      INNOBASE_SKIP_WARNINGS="-Wno-shadow -Wno-cast-align"
355
354
      AS_IF([test "$host_vendor" = "apple"],[
356
355
        BOOSTSKIP_WARNINGS="-Wno-uninitialized"
357
356
      ])