Bugs in the AT&T Toolchest program 'nmake'

Haller jhh at ihlpl.ATT.COM
Sat May 13 06:46:03 AEST 1989


In article <464 at tijc02.UUCP>, cgh018 at tijc02.UUCP (Calvin Hayden    ) writes:
[deleted]
> source to cpp.  One bug is that when compiling using the cpp supplied
> with nmake, often there are warnings about extra characters being ignored.

Recent AT&T cpp's complain about extra characters in #ifdef and #endif's.
In one case I experienced, this detected a hitherto unknown bug.  The
cpp's are only enforcing what had alway's been a part of the 'C' language
definition (see K&R pg 208).  The following #ifdef/#endif usage is common,
but wrong:

#ifdef DEBUG
/* debug code */
#endif DEBUG

The proper syntax is:

#ifdef DEBUG
/* debug code */
#endif /* DEBUG */

The #endif control takes no arguments.  Old cpp's silently ignored the debug
token, but the newer ones do not.  The case where I found a bug was in a
section of code like this:

#ifdef FEATURE1 || FEATURE2
/*common code for feature 1 and feature2*/
#endif

Formerly, cpp was silently interpreting this as #ifdef FEATURE1, throwing
away the "|| FEATURE2".  The correct statement would have been, of course:

#if FEATURE1 || FEATURE2

which is what I changed this to.  Since this particular code had never
been compiled without FEATURE1 but with FEATURE2, we never noticed the
problem, but the new cpp picked this up right away.

John Haller att!ihlpl!jhh or jhh at ihlpl.att.com



More information about the Comp.unix.wizards mailing list