Hello, 2011/10/20 Alan W. Irwin <ir...@beluga.phys.uvic.ca>: > On 2011-10-19 18:49+0100 Andrew Ross wrote: > >> I have now completed the bulk of this [code-standards compliance] work. > > Hi Andrew: > > One more iteration of scripts/style_source.sh was required > to get the last of the style issues (revision 11985). > > As of that revision the "minimal" set of compiler flags, > > CXXFLAGS=-O3 -fvisibility=hidden -std=c++98 > CFLAGS=-O3 -fvisibility=hidden -std=c99 -D_POSIX_C_SOURCE=200112L > FFLAGS=-O3 -std=legacy > > appears to build and ctest without errors. But these -std options and > the -D option appear to be the minimal set of flags that will build > our code. > > For example, the "old" set of flags, > > CXXFLAGS=-O3 -fvisibility=hidden > CFLAGS=-O3 -fvisibility=hidden > FFLAGS=-O3 > > now generates build errors. Here are the first of those: > > /home/software/plplot_svn/HEAD/plplot_cmake_qt/src/plot3d.c: In function > ‘plfplot3dcl’: > /home/software/plplot_svn/HEAD/plplot_cmake_qt/src/plot3d.c:1014: > error: ‘for’ loop initial declarations are only allowed in C99 mode > /home/software/plplot_svn/HEAD/plplot_cmake_qt/src/plot3d.c:1014: > note: use option -std=c99 or -std=gnu99 to compile your code
This is because if you don't use -std option the default value is gnu89 (http://gcc.gnu.org/onlinedocs/gcc-4.6.1/gcc/C-Dialect-Options.html#C-Dialect-Options), that is ANSI C plus GNU extensions. In ANSI C ‘for’ loop initial declarations are not permitted, so this is the source of the error. I see two posibilities: - Maintain the 'for' loop initial declarations and uses allways C99 standard (all modern compilers support it) - Declare the loop index outside the 'for' loop (I prefer this in my programs) I suppose that the decision must be conditioned by the C standard. Probably C99 standard should be adopted definitively in Plplot because all modern compilers support it (not the complete C99 standard but all main features). If your fix the 'for' indexes problem probably another error will appear because you use soma function that only is permitted in C99 and again and again ... Cheers > > Is there any way to avoid these build errors for the "old" set of > flags without generating additional warnings for the "minimal" set of > flags? If not (which is what I suspect), then I think this is a > painful but still acceptable price for our gcc users to pay to get our > code into compliance with c99. However, to minimize the pain for our > users _we must be sure_ to communicate the new minimal CXXFLAGS, > CFLAGS, and FFLAGS requirements to our users Will you do that, please, > in README.release? > > The other issue is the "minimal" set of flags still generates 16 > warning messages. I assume those are a subset of the warning messages > you have already mentioned, but you may want to give first attention > to eliminating these 16 warnings since the above "minimal" compile > flags are probably the ones our users will tend to use as opposed to > the much more demanding set of compiler flags you are using at the > moment that presumably generates many more warnings than the 16. > > Alan > __________________________ > Alan W. Irwin > > Astronomical research affiliation with Department of Physics and Astronomy, > University of Victoria (astrowww.phys.uvic.ca). > > Programming affiliations with the FreeEOS equation-of-state > implementation for stellar interiors (freeeos.sf.net); the Time > Ephemerides project (timeephem.sf.net); PLplot scientific plotting > software package (plplot.sf.net); the libLASi project > (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); > and the Linux Brochure Project (lbproject.sf.net). > __________________________ > > Linux-powered Science > __________________________ > > ------------------------------------------------------------------------------ > The demand for IT networking professionals continues to grow, and the > demand for specialized networking skills is growing even more rapidly. > Take a complimentary Learning@Ciosco Self-Assessment and learn > about Cisco certifications, training, and career opportunities. > http://p.sf.net/sfu/cisco-dev2dev > _______________________________________________ > Plplot-devel mailing list > Plplot-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/plplot-devel > -- ***************************************** José Luis García Pallero jgpall...@gmail.com (o< / / \ V_/_ Use Debian GNU/Linux and enjoy! ***************************************** ------------------------------------------------------------------------------ The demand for IT networking professionals continues to grow, and the demand for specialized networking skills is growing even more rapidly. Take a complimentary Learning@Ciosco Self-Assessment and learn about Cisco certifications, training, and career opportunities. http://p.sf.net/sfu/cisco-dev2dev _______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel