#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    CA
    Posts
    1
    Rep Power
    0

    Question gcc2.95.3 eliminate white space at the end of line


    Hi Folks,
    I have following questions need your help. I need to tweak gcc 2.95.3. For GCC 2.95.3, when the compiler see a white space after the line continuation character '\' it will give me errors. GCC3 this will give an warning. I need to implement the same functionality in GCC2.95.3.
    Following is the code: (There is an whitespace at the end of '\'
    ----------------
    #define max(a,b) (a>b)? \
    a:b
    int main()
    {
    return 1;
    }
    ----------------
    GCC2.95.3 complains:

    line.c:4: parse error before `>'
    line.c:14: stray '\' in program
    line.c:14: parse error before `;'

    GCC3.0 give warnings,but still compiles.
    line.c:3:14: warning: backslash and newline separated by space

    I think the following would be the approach:
    (1) use perl to pre process the .h/.c file.
    This will slow down the compiling speed. So it not recommendated.
    (2) tweak the pre-processor c-syntax file such as c-parse.c/clex.c to allow white space at the end of line continuation character.
    I think this is a better way. But I can not locate the place to add
    this rule in the c syntax file. Generally speaking the Flex program will use the .l file to define language syntax, but I can not find any file with extension 'l'. Is the syntax file defined in c-parse.y? Where can I add this rule to let gcc eat the extra whitespaces ?


    Could you please help me ?
    Thanks a lot.

    -Jack Zhang
    Last edited by Jack Z; June 17th, 2003 at 06:41 PM.

IMN logo majestic logo threadwatch logo seochat tools logo