lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 72bff3e 1/4: Inhibit '-Wsign-conversion' for


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 72bff3e 1/4: Inhibit '-Wsign-conversion' for especially problematic files
Date: Mon, 4 Jun 2018 12:19:52 -0400 (EDT)

branch: master
commit 72bff3e04ff2303d2290dc3b1dda00a9db37fe15
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Inhibit '-Wsign-conversion' for especially problematic files
    
    It is difficult to use '-Wsign-conversion' with C++ code that uses the
    STL because:
    
        std::vector<int> v(1);
        int i = 1;
        return v[i];
                  ^
      error: conversion to 'std::vector<int>::size_type {aka unsigned int}'
      from 'int' may change the sign of the result [-Werror=sign-conversion]
    
    See "Going Native 2013"--Stroustrup: "one of the sad things about the
    standard library is that the indices are unsigned", and Sutter: "It's
    unfortunately a mistake in the STL, in the standard library, that we use
    unsigned indices".
    
    However, it is useful occasionally to build with this flag, filtering
    output with:
      sed -e '/size_type/d'
    to identify remediable warnings.
---
 pchfile_wx.hpp |  1 +
 workhorse.make | 14 ++++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/pchfile_wx.hpp b/pchfile_wx.hpp
index 6f775b0..30a65b6 100644
--- a/pchfile_wx.hpp
+++ b/pchfile_wx.hpp
@@ -36,6 +36,7 @@
 // be disabled for the code using wxWidgets as they occur in wxWidgets headers.
 #if defined __GNUC__
 #   pragma GCC diagnostic ignored "-Wcast-qual"
+#   pragma GCC diagnostic ignored "-Wsign-conversion"
 #endif // defined __GNUC__
 
 #if defined LMI_COMPILER_USES_PCH && !defined LMI_IGNORE_PCH
diff --git a/workhorse.make b/workhorse.make
index fcf70ef..22c7284 100644
--- a/workhorse.make
+++ b/workhorse.make
@@ -489,6 +489,20 @@ wno_float_conv_objects := \
 
 $(wno_float_conv_objects): gcc_common_extra_warnings += -Wno-float-conversion
 
+wno_sign_conv_objects := \
+  $(boost_filesystem_objects) \
+  $(boost_regex_objects) \
+  $(xmlwrapp_objects) \
+  CgiEnvironment.o \
+  CgiUtils.o \
+  crc32.o \
+  getopt.o \
+  md5.o \
+  rate_table.o \
+  round_glibc.o \
+
+$(wno_sign_conv_objects): gcc_common_extra_warnings += -Wno-sign-conversion
+
 ifeq (safestdlib,$(findstring safestdlib,$(build_type)))
   ifeq (3.4.5,$(gcc_version))
     expression_template_0_test.o: gcc_common_extra_warnings += 
-Wno-unused-parameter



reply via email to

[Prev in Thread] Current Thread [Next in Thread]