Hi all,
There's actually no need in NEED_PLDEBUG (include/pldebug.h).
pldebug() can be declared inline and that will silence warnings about
pldebug() being unused. 'inline' keyword is from C99. If it is a
concern that some C compilers may not support 'inline' (but most
modern compilers do), then an appropriate check can be added to the
build system.
The attached patch does what is described above.
Regards,
Dmitri
--
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <griboz...@gmail.com>*/
Index: src/plctrl.c
===================================================================
--- src/plctrl.c (revision 10054)
+++ src/plctrl.c (working copy)
@@ -28,7 +28,6 @@
#define DEBUG
-#define NEED_PLDEBUG
#include "plplotP.h"
#ifdef macintosh
#include "mac.h"
Index: src/plbuf.c
===================================================================
--- src/plbuf.c (revision 10054)
+++ src/plbuf.c (working copy)
@@ -24,7 +24,6 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#define NEED_PLDEBUG
#include "plplotP.h"
#include "drivers.h"
#include "metadefs.h"
Index: src/pldeprecated.c
===================================================================
--- src/pldeprecated.c (revision 10054)
+++ src/pldeprecated.c (working copy)
@@ -25,7 +25,6 @@
is explicitly commented.
*/
-#define NEED_PLDEBUG
#include "plplotP.h"
/*--------------------------------------------------------------------------*\
Index: src/plstdio.c
===================================================================
--- src/plstdio.c (revision 10054)
+++ src/plstdio.c (working copy)
@@ -23,7 +23,6 @@
*/
-#define NEED_PLDEBUG
#include "plplotP.h"
/*
Index: src/plcore.c
===================================================================
--- src/plcore.c (revision 10054)
+++ src/plcore.c (working copy)
@@ -34,7 +34,6 @@
#define DEBUG
-#define NEED_PLDEBUG
#include "plcore.h"
#ifdef ENABLE_DYNDRIVERS
Index: src/pdfutils.c
===================================================================
--- src/pdfutils.c (revision 10054)
+++ src/pdfutils.c (working copy)
@@ -32,7 +32,6 @@
Data can be written to/read from either a file handle or memory buffer.
*/
-#define NEED_PLDEBUG
#include "plplotP.h"
static void print_ieeef (void *, void *);
Index: src/plvect.c
===================================================================
--- src/plvect.c (revision 10054)
+++ src/plvect.c (working copy)
@@ -21,7 +21,6 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#define NEED_PLDEBUG
#include "plplotP.h"
#include <float.h>
#include <ctype.h>
Index: bindings/tk-x-plat/plplotter.c
===================================================================
--- bindings/tk-x-plat/plplotter.c (revision 10054)
+++ bindings/tk-x-plat/plplotter.c (working copy)
@@ -63,7 +63,6 @@
#define DEBUG
*/
-#define NEED_PLDEBUG
#include "plserver.h"
#include "pltkwd.h"
#include "tcpip.h"
Index: bindings/tk/plserver.c
===================================================================
--- bindings/tk/plserver.c (revision 10054)
+++ bindings/tk/plserver.c (working copy)
@@ -36,7 +36,6 @@
command-line option is not supported).
*/
-#define NEED_PLDEBUG
#include "plserver.h"
/* Application-specific command-line options */
Index: bindings/tk/plframe.c
===================================================================
--- bindings/tk/plframe.c (revision 10054)
+++ bindings/tk/plframe.c (working copy)
@@ -49,7 +49,6 @@
#define DEBUGx
-#define NEED_PLDEBUG
#include "plserver.h"
#include "plxwd.h"
#include "tcpip.h"
Index: include/pldebug.h
===================================================================
--- include/pldebug.h (revision 10054)
+++ include/pldebug.h (working copy)
@@ -46,46 +46,38 @@
* must in addition specify -debug. This allows debugging output to tailored
* to many different circumstances but otherwise be fairly unobtrusive.
*
- * Note, any file that actually uses pldebug() must also define NEED_PLDEBUG
- * before the plplotP.h include. This is to eliminate warnings caused by
- * those files in which this is defined but never referenced. All this could
- * be much nicer if CPP had the abilities of m4, sigh..
- *
* Syntax:
* pldebug(label, format [, arg1, arg2, ...] );
*
* The label is typically the calling function name.
\*--------------------------------------------------------------------------*/
-#ifdef NEED_PLDEBUG
-static void
-pldebug( const char *label, ... )
+inline static void
+pldebug( const char *label, const char *fmt, ... )
{
#ifdef DEBUG
va_list args;
- char *fmt;
if (plsc->debug) {
if (plsc->termin)
c_pltext();
- va_start(args, label);
+ va_start(args, fmt);
- /* print out identifying tag */
-
+ /* print out identifying tag */
fprintf(stderr, "%s: ", label);
- /* print out remainder of message */
- /* Need to get fmt BEFORE it's used in the vfprintf */
-
- fmt = (char *) va_arg(args, char *);
+ /* print out remainder of message */
vfprintf(stderr, fmt, args);
va_end(args);
if (plsc->termin)
c_plgra();
}
-#endif /* DEBUG */
+#else /* DEBUG */
+ /* silence "unused parameter" warnings */
+ (void) label;
+ (void) fmt;
+#endif /* DEBUG */
}
-#endif /* NEED_PLDEBUG */
#endif /* __PLDEBUG_H__ */
Index: utils/plrender.c
===================================================================
--- utils/plrender.c (revision 10054)
+++ utils/plrender.c (working copy)
@@ -37,7 +37,6 @@
#define DEBUG
#define DEBUG_ENTER
-#define NEED_PLDEBUG
#include "plplotP.h"
#include "plevent.h"
#include "metadefs.h"
Index: drivers/psttf.cc
===================================================================
--- drivers/psttf.cc (revision 10054)
+++ drivers/psttf.cc (working copy)
@@ -35,7 +35,6 @@
#if defined(PLD_psttf)
-#define NEED_PLDEBUG
#include "plplotP.h"
#include "drivers.h"
#include "ps.h"
Index: drivers/pdf.c
===================================================================
--- drivers/pdf.c (revision 10054)
+++ drivers/pdf.c (working copy)
@@ -41,7 +41,6 @@
#include "hpdf.h"
/* PLplot header files */
-#define NEED_PLDEBUG
/* #define DEBUG */
#include "plplotP.h"
#include "drivers.h"
Index: drivers/plmeta.c
===================================================================
--- drivers/plmeta.c (revision 10054)
+++ drivers/plmeta.c (working copy)
@@ -30,7 +30,6 @@
#ifdef PLD_plmeta
-#define NEED_PLDEBUG
#include "plplotP.h"
#include "drivers.h"
#include "metadefs.h"
Index: drivers/tek.c
===================================================================
--- drivers/tek.c (revision 10054)
+++ drivers/tek.c (working copy)
@@ -14,7 +14,6 @@
defined(PLD_vlt) || /* VLT emulator */ \
defined(PLD_conex) /* conex emulator 4010/4014/4105 */
-#define NEED_PLDEBUG
#include "plplotP.h"
#include "drivers.h"
#include "plevent.h"
Index: drivers/tkwin.c
===================================================================
--- drivers/tkwin.c (revision 10054)
+++ drivers/tkwin.c (working copy)
@@ -36,7 +36,6 @@
#ifdef PLD_tkwin
-#define NEED_PLDEBUG
#include "plplotP.h"
#include "pltkwd.h"
#include "drivers.h"
Index: drivers/tk.c
===================================================================
--- drivers/tk.c (revision 10054)
+++ drivers/tk.c (working copy)
@@ -37,7 +37,6 @@
#ifdef PLD_tk
-#define NEED_PLDEBUG
#include "pltkd.h"
#include "plxwd.h"
#include "pltcl.h"
Index: drivers/ps.c
===================================================================
--- drivers/ps.c (revision 10054)
+++ drivers/ps.c (working copy)
@@ -33,7 +33,6 @@
#define DEBUG
#ifdef PLD_ps
-#define NEED_PLDEBUG
#include "plplotP.h"
#include "drivers.h"
#include "ps.h"
Index: drivers/xwin.c
===================================================================
--- drivers/xwin.c (revision 10054)
+++ drivers/xwin.c (working copy)
@@ -29,7 +29,6 @@
#define DEBUG
#ifdef PLD_xwin
-#define NEED_PLDEBUG
#include "plplotP.h"
#include "plxwd.h"
#include "drivers.h"
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel