Re: [Plplot-devel] -std-c99 generates lots of warnings and a Java example segfault

2011-10-28 Thread Andrew Ross
On Fri, Oct 21, 2011 at 01:06:08PM +0100, Andrew Ross wrote:
> On Fri, Oct 21, 2011 at 09:45:47AM +0100, Andrew Ross wrote:
> > 
> > I have had no response to my previous email about handling unused parameter
> > values. I take that as assent to my proposals, so I will try implementing 
> > the UNUSED macro approach, at least for the core library code in src/ .
> > Once there is a concrete implementation in place people might be in a
> > better position to comment.
> 
> I've now implemented this for src/plargs.c as a file with a lot of 
> unused parameters. Please look at, test and comment on the implementation.

Since no-one has protested, I've gone ahead and started to roll this out 
more widely. I've renamed the macro to PL_UNUSED to avoid potential 
namespace clashes, and moved it to plplot.h. This means we can use it in
the examples as well. This has removed a large number of the remaining
warnings.

Alan: I've noticed one issue that you might want to look at. The file
bindings/tcl/plplot_parameters.h is generated by a sed script. It
creates a large string of commands to pass to the tcl interpreter. 
Unfortunately the length of this string (currently 5296) is greater
than the string length which compilers are required to support under
the ISO C99 standard (4096 characters). The length is even less for 
C89. I don't know whether any compilers enforce this limit, but
it would be prudent to avoid this long static string. Possibilities
include splitting it up into several smaller strings, or dynamically
allocating the string (can be any size) and then copying in the 
commands in smaller chunks. I've also changed how this header is 
included slightly. Since it is a static function copies were being
included in a number of object files which didn't actually use
the function.

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@Cisco 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


Re: [Plplot-devel] -std-c99 generates lots of warnings and a Java example segfault

2011-10-28 Thread Alan W. Irwin
Hi Andrew:

I am going to pass this decision about the correct way to
avoid that long string over to Arjen.  See below.

On 2011-10-28 14:04+0100 Andrew Ross wrote:

> Alan: I've noticed one issue that you might want to look at. The file
> bindings/tcl/plplot_parameters.h is generated by a sed script.  It
> creates a large string of commands to pass to the tcl interpreter.
> Unfortunately the length of this string (currently 5296) is greater
> than the string length which compilers are required to support under
> the ISO C99 standard (4096 characters). The length is even less for
> C89. I don't know whether any compilers enforce this limit, but
> it would be prudent to avoid this long static string. Possibilities
> include splitting it up into several smaller strings, or dynamically
> allocating the string (can be any size) and then copying in the
> commands in smaller chunks. I've also changed how this header is
> included slightly. Since it is a static function copies were being
> included in a number of object files which didn't actually use
> the function.

Hi Arjen:

bindings/tcl/plplot_parameters.h was your original creation so could
you have a look at it to see how to reformat it to avoid the
long string that violates C standards that Andrew referred to above?

I am involved in this to a certain extent because I am the author of
the custom target called check_tcl_parameters (see
bindings/tcl/CMakeLists.txt).  That target uses the "sed" command to
process the #defines in bindings/swig-support/plplotcapi.i to create a
check version called bindings/tcl/plplot_parameters.h_compare in the
build tree.  It then uses the "cmp" command to check the consistency
between that check version and bindings/tcl/plplot_parameters.h.  Just
now I made some changes in bindings/tcl/global_defines.sed so that it
produces styled results.  Therefore as of revision 12013 the
check_tcl_parameters target generates a check version that is in exact
agreement with our already existing styled version of
bindings/tcl/plplot_parameters.h.

By the way, I adopted this method of checking
bindings/tcl/plplot_parameters.h for consistency rather than simply
generating that file, because not all platforms have access to sed.

Note, that once you decide on the appropriate format for
bindings/tcl/plplot_parameters.h to avoid the long string, there
should be no necessity for hand crafting
bindings/tcl/plplot_parameters.h.  Instead, please let me know what
format you desire, and I can do the rest with the appropriate changes
to the sed script and copying the resulting
bindings/tcl/plplot_parameters.h_compare back to
bindings/tcl/plplot_parameters.h.

Alternatively, you do have access to both the sed and cmp commands via
MSYS.  So you have the opportunity of changing the sed script
yourself, running the check_tcl_parameters target, and looking at the
resulting bindings/tcl/plplot_parameters.h_compare to make sure it has
your desired format.  I could help you with the sed part of this if
your sed knowledge is a little rusty (or currently nonexistent).

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@Cisco 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