lmi
[Top][All Lists]
Advanced

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

[lmi] Removing comment induces compiler error


From: Greg Chicares
Subject: [lmi] Removing comment induces compiler error
Date: Mon, 6 Mar 2017 00:24:06 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.6.0

I apply the following patch, and everything compiles. But if I
delete any one of the three changed lines, compilation fails.
How can deleting a commented-out line cause that? AFAICS it's
impossible: the preprocessor removes the commented-out lines
unconditionally, so the compiler can never see them.

Below the patch, I'll copy the diagnostics I get if I delete
only the first commented-out line, in 'database_document.cpp'.

---------8<--------8<--------8<--------8<--------8<--------8<--------8<-------
diff --git a/database_document.cpp b/database_document.cpp
index 21a1ffb..9380a1c 100644
--- a/database_document.cpp
+++ b/database_document.cpp
@@ -31,7 +31,7 @@
 // I tried omitting it, but wasn't able to figure out what the
 // diagnostics really meant.
 
-#include <wx/defs.h>
+//#include <wx/defs.h>
 
 IMPLEMENT_DYNAMIC_CLASS(DatabaseDocument, ProductEditorDocument)
 
diff --git a/rounding_document.cpp b/rounding_document.cpp
index d910afe..22da474 100644
--- a/rounding_document.cpp
+++ b/rounding_document.cpp
@@ -35,7 +35,7 @@
 // I tried omitting it, but wasn't able to figure out what the
 // diagnostics really meant.
 
-#include <wx/defs.h>
+//#include <wx/defs.h>
 
 IMPLEMENT_DYNAMIC_CLASS(RoundingDocument, ProductEditorDocument)
 
diff --git a/tier_document.cpp b/tier_document.cpp
index a568729..1fc18f3 100644
--- a/tier_document.cpp
+++ b/tier_document.cpp
@@ -30,7 +30,7 @@
 // I tried omitting it, but wasn't able to figure out what the
 // diagnostics really meant.
 
-#include <wx/defs.h>
+//#include <wx/defs.h>
 
 #include <vector>
 
--------->8-------->8-------->8-------->8-------->8-------->8-------->8-------

Here are the diagnostics promised above, but on second thought I'll show
only the first ~100 out of 687 lines:

i686-w64-mingw32-g++ -MMD -MP -MT database_document.o -MF database_document.d  
-c -I /opt/lmi/src/lmi -I /opt/lmi/src/lmi/tools/pete-2.1.1 -I 
/opt/lmi/local/lib/wx/include/i686-w64-mingw32-msw-unicode-3.1 -I 
/opt/lmi/local/include/wx-3.1 -I /opt/lmi/third_party/include -I 
/opt/lmi/third_party/src -I /opt/lmi/local/include -I 
/opt/lmi/local/include/libxml2 -DLMI_WX_NEW_USE_SO  -DLIBXML_USE_DLL -DSTRICT   
 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXMSW__ -DBOOST_STRICT_CONFIG   
-std=c++11 -pedantic-errors -Werror -Wall -Wcast-align -Wconversion 
-Wdeprecated-declarations -Wdisabled-optimization -Wextra -Wimport -Wmultichar 
-Wpacked -Wpointer-arith -Wredundant-decls -Wsign-compare -Wundef 
-Wwrite-strings  -Wno-long-long -Wctor-dtor-privacy -Wdeprecated 
-Wnon-template-friend -Woverloaded-virtual -Wpmf-conversions -Wsynth  
-Wcast-qual  -Wno-conversion -Wno-deprecated-declarations -Wno-parentheses 
-Wno-unused-local-typedefs -Wno-unused-variable     -ggdb -O2 
-fno-omit-frame-pointer    /opt/lmi/src/lmi/database_document.cpp 
-odatabase_document.o
make[1]: Nothing to be done for 'check_physical_closure'.
In file included from /opt/lmi/local/include/wx-3.1/wx/arrstr.h:52:0,
                 from /opt/lmi/local/include/wx-3.1/wx/filefn.h:15,
                 from /opt/lmi/local/include/wx-3.1/wx/utils.h:20,
                 from /opt/lmi/local/include/wx-3.1/wx/dlist.h:14,
                 from /opt/lmi/local/include/wx-3.1/wx/docview.h:19,
                 from /opt/lmi/src/lmi/view_ex.hpp:74,
                 from /opt/lmi/src/lmi/product_editor.hpp:27,
                 from /opt/lmi/src/lmi/database_document.hpp:27,
                 from /opt/lmi/src/lmi/database_document.cpp:24:
/opt/lmi/local/include/wx-3.1/wx/dynarray.h: In member function 'const void*& 
wxBaseArrayPtrVoid::Item(size_t) const':
/opt/lmi/local/include/wx-3.1/wx/dynarray.h:144:66: error: cast from type 
'const void* const*' to type 'const void**' casts away qualifiers 
[-Werror=cast-qual]
     { wxASSERT( uiIndex < size() ); return (T&)operator[](uiIndex); }   \
                                                                  ^
/opt/lmi/local/include/wx-3.1/wx/dynarray.h:114:4: note: in expansion of macro 
'_WX_DECLARE_BASEARRAY_2'
    _WX_DECLARE_BASEARRAY_2(T, name, name##_Predicate, classexp)
    ^
/opt/lmi/local/include/wx-3.1/wx/dynarray.h:663:5: note: in expansion of macro 
'_WX_DECLARE_BASEARRAY'
     _WX_DECLARE_BASEARRAY(_wxArray##name, name, class expmode)
     ^
/opt/lmi/local/include/wx-3.1/wx/dynarray.h:837:1: note: in expansion of macro 
'WX_DECLARE_USER_EXPORTED_BASEARRAY'
 WX_DECLARE_USER_EXPORTED_BASEARRAY(const void *, wxBaseArrayPtrVoid,
 ^
/opt/lmi/local/include/wx-3.1/wx/dynarray.h: In member function 
'_wxArraywxBaseArrayChar& wxBaseArrayChar::Item(size_t) const':
/opt/lmi/local/include/wx-3.1/wx/dynarray.h:144:66: error: cast from type 
'const value_type* {aka const char*}' to type '_wxArraywxBaseArrayChar* {aka 
char*}' casts away qualifiers [-Werror=cast-qual]
     { wxASSERT( uiIndex < size() ); return (T&)operator[](uiIndex); }   \
                                                                  ^
/opt/lmi/local/include/wx-3.1/wx/dynarray.h:114:4: note: in expansion of macro 
'_WX_DECLARE_BASEARRAY_2'
    _WX_DECLARE_BASEARRAY_2(T, name, name##_Predicate, classexp)
    ^
/opt/lmi/local/include/wx-3.1/wx/dynarray.h:663:5: note: in expansion of macro 
'_WX_DECLARE_BASEARRAY'
     _WX_DECLARE_BASEARRAY(_wxArray##name, name, class expmode)
     ^
/opt/lmi/local/include/wx-3.1/wx/dynarray.h:839:1: note: in expansion of macro 
'WX_DECLARE_USER_EXPORTED_BASEARRAY'
 WX_DECLARE_USER_EXPORTED_BASEARRAY(char, wxBaseArrayChar, WXDLLIMPEXP_BASE);
 ^
/opt/lmi/local/include/wx-3.1/wx/dynarray.h: In member function 
'_wxArraywxBaseArrayShort& wxBaseArrayShort::Item(size_t) const':
/opt/lmi/local/include/wx-3.1/wx/dynarray.h:144:66: error: cast from type 
'const value_type* {aka const short int*}' to type '_wxArraywxBaseArrayShort* 
{aka short int*}' casts away qualifiers [-Werror=cast-qual]
     { wxASSERT( uiIndex < size() ); return (T&)operator[](uiIndex); }   \
                                                                  ^
/opt/lmi/local/include/wx-3.1/wx/dynarray.h:114:4: note: in expansion of macro 
'_WX_DECLARE_BASEARRAY_2'
    _WX_DECLARE_BASEARRAY_2(T, name, name##_Predicate, classexp)
    ^
/opt/lmi/local/include/wx-3.1/wx/dynarray.h:663:5: note: in expansion of macro 
'_WX_DECLARE_BASEARRAY'
     _WX_DECLARE_BASEARRAY(_wxArray##name, name, class expmode)
     ^
/opt/lmi/local/include/wx-3.1/wx/dynarray.h:840:1: note: in expansion of macro 
'WX_DECLARE_USER_EXPORTED_BASEARRAY'
 WX_DECLARE_USER_EXPORTED_BASEARRAY(short, wxBaseArrayShort, WXDLLIMPEXP_BASE);
 ^
/opt/lmi/local/include/wx-3.1/wx/dynarray.h: In member function 
'_wxArraywxBaseArrayInt& wxBaseArrayInt::Item(size_t) const':
/opt/lmi/local/include/wx-3.1/wx/dynarray.h:144:66: error: cast from type 
'const value_type* {aka const int*}' to type '_wxArraywxBaseArrayInt* {aka 
int*}' casts away qualifiers [-Werror=cast-qual]
     { wxASSERT( uiIndex < size() ); return (T&)operator[](uiIndex); }   \
                                                                  ^
/opt/lmi/local/include/wx-3.1/wx/dynarray.h:114:4: note: in expansion of macro 
'_WX_DECLARE_BASEARRAY_2'
    _WX_DECLARE_BASEARRAY_2(T, name, name##_Predicate, classexp)
    ^
/opt/lmi/local/include/wx-3.1/wx/dynarray.h:663:5: note: in expansion of macro 
'_WX_DECLARE_BASEARRAY'
     _WX_DECLARE_BASEARRAY(_wxArray##name, name, class expmode)
     ^
/opt/lmi/local/include/wx-3.1/wx/dynarray.h:841:1: note: in expansion of macro 
'WX_DECLARE_USER_EXPORTED_BASEARRAY'
 WX_DECLARE_USER_EXPORTED_BASEARRAY(int, wxBaseArrayInt, WXDLLIMPEXP_BASE);
 ^
/opt/lmi/local/include/wx-3.1/wx/dynarray.h: In member function 
'_wxArraywxBaseArrayLong& wxBaseArrayLong::Item(size_t) const':
/opt/lmi/local/include/wx-3.1/wx/dynarray.h:144:66: error: cast from type 
'const value_type* {aka const long int*}' to type '_wxArraywxBaseArrayLong* 
{aka long int*}' casts away qualifiers [-Werror=cast-qual]
     { wxASSERT( uiIndex < size() ); return (T&)operator[](uiIndex); }   \
                                                                  ^
/opt/lmi/local/include/wx-3.1/wx/dynarray.h:114:4: note: in expansion of macro 
'_WX_DECLARE_BASEARRAY_2'
    _WX_DECLARE_BASEARRAY_2(T, name, name##_Predicate, classexp)
    ^
/opt/lmi/local/include/wx-3.1/wx/dynarray.h:663:5: note: in expansion of macro 
'_WX_DECLARE_BASEARRAY'
     _WX_DECLARE_BASEARRAY(_wxArray##name, name, class expmode)
     ^
/opt/lmi/local/include/wx-3.1/wx/dynarray.h:842:1: note: in expansion of macro 
'WX_DECLARE_USER_EXPORTED_BASEARRAY'
 WX_DECLARE_USER_EXPORTED_BASEARRAY(long, wxBaseArrayLong, WXDLLIMPEXP_BASE);
 ^
/opt/lmi/local/include/wx-3.1/wx/dynarray.h: In member function 
'_wxArraywxBaseArraySizeT& wxBaseArraySizeT::Item(size_t) const':
/opt/lmi/local/include/wx-3.1/wx/dynarray.h:144:66: error: cast from type 
'const value_type* {aka const unsigned int*}' to type 
'_wxArraywxBaseArraySizeT* {aka unsigned int*}' casts away qualifiers 
[-Werror=cast-qual]
     { wxASSERT( uiIndex < size() ); return (T&)operator[](uiIndex); }   \
                                                                  ^
/opt/lmi/local/include/wx-3.1/wx/dynarray.h:114:4: note: in expansion of macro 
'_WX_DECLARE_BASEARRAY_2'
    _WX_DECLARE_BASEARRAY_2(T, name, name##_Predicate, classexp)
    ^
/opt/lmi/local/include/wx-3.1/wx/dynarray.h:663:5: note: in expansion of macro 
'_WX_DECLARE_BASEARRAY'
     _WX_DECLARE_BASEARRAY(_wxArray##name, name, class expmode)
     ^
/opt/lmi/local/include/wx-3.1/wx/dynarray.h:843:1: note: in expansion of macro 
'WX_DECLARE_USER_EXPORTED_BASEARRAY'
 WX_DECLARE_USER_EXPORTED_BASEARRAY(size_t, wxBaseArraySizeT, WXDLLIMPEXP_BASE);
 ^
/opt/lmi/local/include/wx-3.1/wx/dynarray.h: In member function 
'_wxArraywxBaseArrayDouble& wxBaseArrayDouble::Item(size_t) const':
/opt/lmi/local/include/wx-3.1/wx/dynarray.h:144:66: error: cast from type 
'const value_type* {aka const double*}' to type '_wxArraywxBaseArrayDouble* 
{aka double*}' casts away qualifiers [-Werror=cast-qual]
     { wxASSERT( uiIndex < size() ); return (T&)operator[](uiIndex); }   \
                                                                  ^
/opt/lmi/local/include/wx-3.1/wx/dynarray.h:114:4: note: in expansion of macro 
'_WX_DECLARE_BASEARRAY_2'
    _WX_DECLARE_BASEARRAY_2(T, name, name##_Predicate, classexp)
    ^
/opt/lmi/local/include/wx-3.1/wx/dynarray.h:663:5: note: in expansion of macro 
'_WX_DECLARE_BASEARRAY'
     _WX_DECLARE_BASEARRAY(_wxArray##name, name, class expmode)
     ^
/opt/lmi/local/include/wx-3.1/wx/dynarray.h:844:1: note: in expansion of macro 
'WX_DECLARE_USER_EXPORTED_BASEARRAY'
 WX_DECLARE_USER_EXPORTED_BASEARRAY(double, wxBaseArrayDouble, 
WXDLLIMPEXP_BASE);
 ^

reply via email to

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