]> granicus.if.org Git - curl/commitdiff
curl-compilers.m4: enable -Wshift-sign-overflow for clang
authorMarcel Raad <Marcel.Raad@teamviewer.com>
Tue, 30 May 2017 08:07:47 +0000 (10:07 +0200)
committerMarcel Raad <Marcel.Raad@teamviewer.com>
Wed, 31 May 2017 08:06:53 +0000 (10:06 +0200)
clang 2.9+ supports -Wshift-sign-overflow, which warns about undefined
behavior on signed left shifts when shifting by too many places.

Ref: https://github.com/curl/curl/issues/1516
Closes https://github.com/curl/curl/pull/1517

m4/curl-compilers.m4

index 5890324468a0055411dde5b77288b73f86a6863a..673f640979a345332c84876331c0c0c4e5d9fe4b 100644 (file)
@@ -881,6 +881,11 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
           if test "$compiler_num" -ge "101"; then
             tmp_CFLAGS="$tmp_CFLAGS -Wunused"
           fi
+          #
+          dnl Only clang 2.9 or later
+          if test "$compiler_num" -ge "209"; then
+            tmp_CFLAGS="$tmp_CFLAGS -Wshift-sign-overflow"
+          fi
         fi
         ;;
         #