On Thu, Oct 20, 2011 at 08:37:46AM +0200, Jos? Luis Garc?a Pallero wrote: > 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 ... >
This is a simple problem to fix using option 2, so I've done so. I tend to agree with Alan that we should try to be standards compliant, but we should also try to ensure that we don't need special flags for "common" compilers like gcc. Some parts of the code are sprinkled with variable definition part way through the code with local scope of a particular block. This always strikes me as a messy way of doing things. Gcc with no standards flags is now warning free again. Andrew ------------------------------------------------------------------------------ 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