curl-compilers.m4: enable double-promotion warning
authorMarcel Raad <raad@teamviewer.com>
Fri, 16 Jun 2017 12:06:23 +0000 (14:06 +0200)
committerMarcel Raad <raad@teamviewer.com>
Fri, 16 Jun 2017 20:31:57 +0000 (22:31 +0200)
Enable -Wdouble-promotion for both GCC and clang. It warns on implicit
promotion from float to double.

Closes https://github.com/curl/curl/pull/1578

m4/curl-compilers.m4

index 5860f946efc7b90c34a244ac66996afcc6b0d65f..7d53953c91d48f327775378adbb93fa84ebd0855 100644 (file)
@@ -891,6 +891,11 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
           if test "$compiler_num" -ge "209"; then
             tmp_CFLAGS="$tmp_CFLAGS -Wshift-sign-overflow"
           fi
+          #
+          dnl Only clang 3.6 or later
+          if test "$compiler_num" -ge "306"; then
+            tmp_CFLAGS="$tmp_CFLAGS -Wdouble-promotion"
+          fi
         fi
         ;;
         #
@@ -1002,6 +1007,11 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
             fi
           fi
           #
+          dnl Only gcc 4.6 or later
+          if test "$compiler_num" -ge "406"; then
+            tmp_CFLAGS="$tmp_CFLAGS -Wdouble-promotion"
+          fi
+          #
         fi
         #
         dnl Do not issue warnings for code in system include paths.