llvm.org GIT mirror llvm / 4cd064b
Add a check for misbehaving -Wcomment from gcc-4.7 and add -Wno-comment to the compilation flags if so. Patch by Filipe Cabecinhas, configure regenerated by me. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221323 91177308-0d34-0410-b5e6-96231b3b80d8 Eric Christopher 4 years ago
4 changed file(s) with 97 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
395395 NO_UNINITIALIZED = @NO_UNINITIALIZED@
396396 # -Wno-maybe-uninitialized
397397 NO_MAYBE_UNINITIALIZED = @NO_MAYBE_UNINITIALIZED@
398 # -Wno-comment
399 NO_COMMENT = @NO_COMMENT@
398400
399401 # Was polly found in tools/polly?
400402 LLVM_HAS_POLLY = @LLVM_HAS_POLLY@
678678 CompileCommonOpts += -Wall -W -Wno-unused-parameter -Wwrite-strings \
679679 $(EXTRA_OPTIONS) $(COVERED_SWITCH_DEFAULT) \
680680 $(NO_UNINITIALIZED) $(NO_MAYBE_UNINITIALIZED) \
681 $(NO_MISSING_FIELD_INITIALIZERS)
681 $(NO_MISSING_FIELD_INITIALIZERS) $(NO_COMMENT)
682682 # Enable cast-qual for C++; the workaround is to use const_cast.
683683 CXX.Flags += -Wcast-qual
684684
13851385 CXX_FLAG_CHECK(NO_UNINITIALIZED, [-Wno-uninitialized])
13861386 fi
13871387 fi
1388 AC_MSG_RESULT([$NO_VARIADIC_MACROS $NO_MISSING_FIELD_INITIALIZERS $COVERED_SWITCH_DEFAULT $NO_UNINITIALIZED $NO_MAYBE_UNINITIALIZED])
1388
1389 dnl Check for misbehaving -Wcomment (gcc-4.7 has this) and maybe add
1390 dnl -Wno-comment to the flags.
1391 no_comment=
1392 llvm_cv_old_cxxflags="$CXXFLAGS"
1393 CXXFLAGS="$CXXFLAGS -Wcomment -Werror"
1394 AC_COMPILE_IFELSE(
1395 [
1396 AC_LANG_SOURCE([[// Comment \o\
1397 // Another comment
1398 int main() { return 0; }
1399 ]])
1400 ],
1401 [
1402 no_comment=-Wno-comment
1403 ],
1404 [])
1405 AC_SUBST(NO_COMMENT, [$no_comment])
1406 CXXFLAGS="$llvm_cv_old_cxxflags"
1407
1408 AC_MSG_RESULT([$NO_VARIADIC_MACROS $NO_MISSING_FIELD_INITIALIZERS $COVERED_SWITCH_DEFAULT $NO_UNINITIALIZED $NO_MAYBE_UNINITIALIZED $NO_COMMENT])
13891409
13901410 AC_ARG_WITH([python],
13911411 [AS_HELP_STRING([--with-python], [path to python])],
761761 COVERED_SWITCH_DEFAULT
762762 NO_MAYBE_UNINITIALIZED
763763 NO_UNINITIALIZED
764 NO_COMMENT
764765 PYTHON
765766 HAVE_DLOPEN
766767 HAVE_TERMINFO
80658066
80668067 fi
80678068 fi
8068 { echo "$as_me:$LINENO: result: $NO_VARIADIC_MACROS $NO_MISSING_FIELD_INITIALIZERS $COVERED_SWITCH_DEFAULT $NO_UNINITIALIZED $NO_MAYBE_UNINITIALIZED" >&5
8069 echo "${ECHO_T}$NO_VARIADIC_MACROS $NO_MISSING_FIELD_INITIALIZERS $COVERED_SWITCH_DEFAULT $NO_UNINITIALIZED $NO_MAYBE_UNINITIALIZED" >&6; }
8069
8070 no_comment=
8071 llvm_cv_old_cxxflags="$CXXFLAGS"
8072 CXXFLAGS="$CXXFLAGS -Wcomment -Werror"
8073 cat >conftest.$ac_ext <<_ACEOF
8074
8075 /* confdefs.h. */
8076 _ACEOF
8077 cat confdefs.h >>conftest.$ac_ext
8078 cat >>conftest.$ac_ext <<_ACEOF
8079 /* end confdefs.h. */
8080 // Comment \o\
8081 // Another comment
8082 int main() { return 0; }
8083
8084
8085 _ACEOF
8086 rm -f conftest.$ac_objext
8087 if { (ac_try="$ac_compile"
8088 case "(($ac_try" in
8089 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
8090 *) ac_try_echo=$ac_try;;
8091 esac
8092 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
8093 (eval "$ac_compile") 2>conftest.er1
8094 ac_status=$?
8095 grep -v '^ *+' conftest.er1 >conftest.err
8096 rm -f conftest.er1
8097 cat conftest.err >&5
8098 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8099 (exit $ac_status); } &&
8100 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
8101 { (case "(($ac_try" in
8102 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
8103 *) ac_try_echo=$ac_try;;
8104 esac
8105 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
8106 (eval "$ac_try") 2>&5
8107 ac_status=$?
8108 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8109 (exit $ac_status); }; } &&
8110 { ac_try='test -s conftest.$ac_objext'
8111 { (case "(($ac_try" in
8112 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
8113 *) ac_try_echo=$ac_try;;
8114 esac
8115 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
8116 (eval "$ac_try") 2>&5
8117 ac_status=$?
8118 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8119 (exit $ac_status); }; }; then
8120
8121 no_comment=-Wno-comment
8122
8123 else
8124 echo "$as_me: failed program was:" >&5
8125 sed 's/^/| /' conftest.$ac_ext >&5
8126
8127
8128 fi
8129
8130 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
8131 NO_COMMENT=$no_comment
8132
8133 CXXFLAGS="$llvm_cv_old_cxxflags"
8134
8135 { echo "$as_me:$LINENO: result: $NO_VARIADIC_MACROS $NO_MISSING_FIELD_INITIALIZERS $COVERED_SWITCH_DEFAULT $NO_UNINITIALIZED $NO_MAYBE_UNINITIALIZED $NO_COMMENT" >&5
8136 echo "${ECHO_T}$NO_VARIADIC_MACROS $NO_MISSING_FIELD_INITIALIZERS $COVERED_SWITCH_DEFAULT $NO_UNINITIALIZED $NO_MAYBE_UNINITIALIZED $NO_COMMENT" >&6; }
80708137
80718138
80728139 # Check whether --with-python was given.
1927719344 COVERED_SWITCH_DEFAULT!$COVERED_SWITCH_DEFAULT$ac_delim
1927819345 NO_MAYBE_UNINITIALIZED!$NO_MAYBE_UNINITIALIZED$ac_delim
1927919346 NO_UNINITIALIZED!$NO_UNINITIALIZED$ac_delim
19347 NO_COMMENT!$NO_COMMENT$ac_delim
1928019348 PYTHON!$PYTHON$ac_delim
1928119349 HAVE_DLOPEN!$HAVE_DLOPEN$ac_delim
1928219350 HAVE_TERMINFO!$HAVE_TERMINFO$ac_delim
1931119379 LTLIBOBJS!$LTLIBOBJS$ac_delim
1931219380 _ACEOF
1931319381
19314 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 95; then
19382 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 96; then
1931519383 break
1931619384 elif $ac_last_try; then
1931719385 { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
1933019398
1933119399 cat >>$CONFIG_STATUS <<_ACEOF
1933219400 cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof
19333 /@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
19401 /@[a-zA-Z_][a-zA-Z_0-9]*@/!b
1933419402 _ACEOF
1933519403 sed '
1933619404 s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
1934319411 ' >>$CONFIG_STATUS
1934419412 rm -f conf$$subs.sed
1934519413 cat >>$CONFIG_STATUS <<_ACEOF
19346 :end
19347 s/|#_!!_#|//g
1934819414 CEOF$ac_eof
1934919415 _ACEOF
1935019416
1959219658 s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
1959319659 s&@INSTALL@&$ac_INSTALL&;t t
1959419660 $ac_datarootdir_hack
19595 " $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out
19661 " $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" | sed 's/|#_!!_#|//g' >$tmp/out
1959619662
1959719663 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
1959819664 { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&