[fltk.development] [RFE] STR #2728: Add test program to test for shadowed variables (-Wshadow)
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR New] Link: http://www.fltk.org/str.php?L2728 Version: 1.3-feature To test for problems with variable shadowing (for apps that compile against FLTK with e.g. -Wshadow), we could make one test program that #include's all fltk widgets, instancing them once, and have just that test program compile with -Wshadow (or equivalent depending on the compiler) This way future builds will show any shadow errors in our .H's as part of the build. Link: http://www.fltk.org/str.php?L2728 Version: 1.3-feature ___ fltk-dev mailing list fltk-dev@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-dev
Re: [fltk.development] [RFE] STR #2728: Add test program to test for shadowed variables (-Wshadow)
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR New] Link: http://www.fltk.org/str.php?L2728 Version: 1.3-feature Attached file "shadow-variables-test-program.patch"... Link: http://www.fltk.org/str.php?L2728 Version: 1.3-featureIndex: Makefile === --- Makefile(revision 9132) +++ Makefile(working copy) @@ -80,6 +80,7 @@ resize.cxx \ rotated_text.cxx \ scroll.cxx \ + shadow_varaibles.cxx \ shape.cxx \ subwindow.cxx \ sudoku.cxx \ @@ -190,6 +191,7 @@ $(RM) keyboard_ui.cxx keyboard_ui.h $(RM) mandelbrot_ui.cxx mandelbrot_ui.h $(RM) preferences.cxx preferences.h + $(RM) shadow_variables.cxx $(RM) radio.cxx radio.h $(RM) resize.cxx resize.h $(RM) tabs.cxx tabs.h @@ -484,6 +486,16 @@ echo Linking $@... $(CXX) $(ARCHFLAGS) $(LDFLAGS) -o $@ gl_overlay.o $(LINKFLTKGL) $(LINKFLTK) $(GLDLIBS) +shadow_variables.cxx: . + echo '#include ' > shadow_variables.cxx + (cd ..; perl -e 'opendir(DIR,"FL/"); foreach(sort(readdir(DIR))) { if( /\.H$$/ && !/^mac.H$$/ && !/^win32.H$$/ && !/^x.H$$/) {print "#include \n"; } }' ) >> shadow_variables.cxx + echo 'int main() { printf("No errors.\n"); return(0); }' >> shadow_variables.cxx + +ifeq ($(CXX),g++) +shadow_variables: shadow_variables.cxx + $(CXX) -Wshadow $(ARCHFLAGS) $(LDFLAGS) $< -o $@ $(LINKFLTK) +endif + shape$(EXEEXT): shape.o echo Linking $@... $(CXX) $(ARCHFLAGS) $(LDFLAGS) -o $@ shape.o $(LINKFLTKGL) $(LINKFLTK) $(GLDLIBS) ___ fltk-dev mailing list fltk-dev@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-dev
Re: [fltk.development] [RFE] STR #2728: Add test program to test for shadowed variables (-Wshadow)
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR New] Link: http://www.fltk.org/str.php?L2728 Version: 1.3-feature Attached a test/Makefile (shadow-variables-test-program.patch) patch to generate the shadow_variables.cxx automatically, based on all the include'able FL/*.H files, with some exceptions. By automatically generating the shadow variable test program, devs don't have to modify the test program every time a new #include file is added. However, this patch uses a one-liner perl script to generate the file, also creating perhaps an unwanted dependence on perl. Will follow up with an attachment of the 'generated' shadow-variables.cxx file, just to show what it should look like. I suppose the alternative to the above automated approach is to check in this .cxx file, and have devs add all new .H files to it. The goal here is to have a build of FLTK fail if there are any shadowing variables in any of our .H files. Link: http://www.fltk.org/str.php?L2728 Version: 1.3-feature ___ fltk-dev mailing list fltk-dev@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-dev
Re: [fltk.development] [RFE] STR #2728: Add test program to test for shadowed variables (-Wshadow)
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR New] Link: http://www.fltk.org/str.php?L2728 Version: 1.3-feature Attached file "shadow_variables.cxx"... Link: http://www.fltk.org/str.php?L2728 Version: 1.3-feature#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include int main() { printf("No errors.\n"); return(0); } ___ fltk-dev mailing list fltk-dev@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-dev
Re: [fltk.development] [RFE] STR #2728: Add test program to test for shadowed variables (-Wshadow)
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR New] Link: http://www.fltk.org/str.php?L2728 Version: 1.3-feature Link: http://www.fltk.org/str.php?L2728 Version: 1.3-feature ___ fltk-dev mailing list fltk-dev@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-dev