Scott Adkins wrote:

Even though your suggestions were good, they weren't applicable to this
particular issue.  In fact, running the find command to find all the
source files with indented directives only showed up a couple lines as
follows (using a slightly different command than you supplied):

 % find . -name '*.[ch]' | xargs egrep '^[: :]+#'
 ./sieve/addr-lex.c: #pragma warn -rch
 ./sieve/addr-lex.c: #pragma warn -use
 ./sieve/sieve-lex.c: #pragma warn -rch
 ./sieve/sieve-lex.c: #pragma warn -use

Even though it has no bearing on the problem I was having, it is worth
fixing those few lines (by removing the single space before the #pragma)
just to increase the portability of the source code.

These files are generated by flex, and I don't think we want to get into massaging its output. Are you saying that the leading space is illegal, or that your compiler just doesn't like it?




Scott


--On Wednesday, July 23, 2003 7:24 AM +0200 Nikola Milutinovic <[EMAIL PROTECTED]> wrote:

"First thing first", to quote your message. Have you cleaned up the
source from indented CPP directives?

GCC (and possibly other C compilers) support indentation of CPP
directives (#define, #include, etc.). CC doesn't deal with this and
ignores such lines. There is no public standard that allows it - the most
that is allowed is to indent the directive, but to keep "#" in column 1.
So, this is what GNU allows:

# ifdef HAS_GETADDRINF
    #define OK
    #include <sys/socket.h>
# else
    #include <sys/sock5.h>
# endif

DEC CC would go no further than this:

# ifdef HAS_GETADDRINF
#    define OK
#    include <sys/socket.h>
# else
#    include <sys/sock5.h>
# endif

So, the first thing to do is clean up all "*.c", "*.h" and "configure*"
files that you can find. I use a script:

find . \( -name "configure*" -o -name "*.c" -o -name "*.h" \) -exec grep
-E "^( |\t)( |\t)*#(i|d|e|p|u)" {} \; -print

(I have placed "\t" for TABs, in my script they are really TABs - cant
display TABs in MS Outlook Express).

Then look at what's reported and edit all those files. Or write another
script to do the change - "sed" comes to mind. Or Perl.

When you have cleaned up, then you can start tracking errors and bugs.

Nix.





-- Kenneth Murchison Oceana Matrix Ltd. Software Engineer 21 Princeton Place 716-662-8973 x26 Orchard Park, NY 14127 --PGP Public Key-- http://www.oceana.com/~ken/ksm.pgp



Reply via email to