]> git.saurik.com Git - bison.git/commitdiff
build: please Clang++ 3.2+ on Flex scanners
authorAkim Demaille <akim@lrde.epita.fr>
Wed, 30 Jan 2013 14:28:08 +0000 (15:28 +0100)
committerAkim Demaille <akim@lrde.epita.fr>
Wed, 30 Jan 2013 15:10:00 +0000 (16:10 +0100)
Clang++, with -Wall, rejects code generated by Flex (for C scanners):

  CXX      examples/calc++/examples_calc___calc__-calc++-scanner.o
  In file included from examples/calc++/calc++-scanner.cc:1:
  error: implicit conversion of NULL constant to 'bool' [-Werror,-Wnull-conversion]
  if ( ! ( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)] : __null) ) {
       ~                                                                  ^~~~~~
                                                                          false
* configure.ac (WARN_NO_NULL_CONVERSION_CXXFLAGS): Compute it.
* examples/calc++/local.mk (examples_calc___calc___CXXFLAGS): Use it.

configure.ac
examples/calc++/local.mk

index 76a0ecf98e6b269caf42ea97488fa99106499d5e..289b29956d0b8b3969ed74dcb3cc622d74cbd545 100644 (file)
@@ -133,6 +133,8 @@ if test "$enable_gcc_warnings" = yes; then
   # Warnings for the test suite only.
   gl_WARN_ADD([-Wundef], [WARN_CXXFLAGS_TEST])
   gl_WARN_ADD([-pedantic], [WARN_CXXFLAGS_TEST])
+  # Clang++ 3.2+ reject C code generated by Flex.
+  gl_WARN_ADD([-Wno-null-conversion], [WARN_NO_NULL_CONVERSION_CXXFLAGS])
   # Variants break strict aliasing analysis.
   gl_WARN_ADD([-fno-strict-aliasing], [NO_STRICT_ALIAS_CXXFLAGS])
   CXXFLAGS=$save_CXXFLAGS
index c0cb5e81fa1c27b5e9c16ac8ab5cf1306faa49e2..6eb31f8919e9049ac0bee7e7f6b426e18d388376 100644 (file)
@@ -69,5 +69,7 @@ nodist_examples_calc___calc___SOURCES =               \
   $(calc_sources)
 
 examples_calc___calc___CPPFLAGS = -I$(top_builddir)/examples/calc++
+examples_calc___calc___CXXFLAGS =                      \
+  $(AM_CXXFLAGS) $(WARN_NO_NULL_CONVERSION_CXXFLAGS)
 dist_TESTS += examples/calc++/calc++.test
 endif