lua-users home
lua-l archive

Warnings compiling LPeg

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


 At work, I use LPeg for parsing. It's embedded and as such, I use a
project level Makefile to compile everything (including LPeg). Recently
(like half an hour ago) I tried compiling the project with:
	make CFLAGS="-DNDEBUG"
and the following warnings popped up:
In file included from third_party/lpeg/lpcap.h:9:0,
 from third_party/lpeg/lpvm.c:13:
third_party/lpeg/lptypes.h:13:0: warning: "NDEBUG" redefined [enabled by default]
<command-line>:0:0: note: this is the location of the previous definition
In file included from third_party/lpeg/lpcap.h:9:0,
 from third_party/lpeg/lpcap.c:9:
third_party/lpeg/lptypes.h:13:0: warning: "NDEBUG" redefined [enabled by default]
<command-line>:0:0: note: this is the location of the previous definition
In file included from third_party/lpeg/lptree.c:14:0:
third_party/lpeg/lptypes.h:13:0: warning: "NDEBUG" redefined [enabled by default]
<command-line>:0:0: note: this is the location of the previous definition
In file included from third_party/lpeg/lpcode.c:12:0:
third_party/lpeg/lptypes.h:13:0: warning: "NDEBUG" redefined [enabled by default]
<command-line>:0:0: note: this is the location of the previous definition
In file included from third_party/lpeg/lpprint.c:11:0:
third_party/lpeg/lptypes.h:13:0: warning: "NDEBUG" redefined [enabled by default]
<command-line>:0:0: note: this is the location of the previous definition
 The offending code from lptypes.h:
	#if !defined(LPEG_DEBUG)
	#define NDEBUG
	#endif
I'm not sure how I feel about this. It seems problematic. For development
and initial testing, I don't define NDEBUG (so asserts are enabled) and yet,
here's some code that "arbitrarily" sets NDEBUG if some other define isn't
defined. I know I can change the code, but I'd rather not have to patch it
if possible. I know the intent is to avoid including debugging code by
default but I would think there would have to be a better way.
 -spc

AltStyle によって変換されたページ (->オリジナル) /