delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/01/09/12:05:42

From: giusti AT agranat DOT com ("Kenneth A.Giusti")
Subject: #line pre-processor bug in B17.0 on NT4.0
9 Jan 1997 12:05:42 -0800 :
Sender: daemon AT cygnus DOT com
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <199701091754.MAA03614.cygnus.gnu-win32@colossus.agranat.com>
Original-To: gnu-win32 AT cygnus DOT com
Original-Sender: owner-gnu-win32 AT cygnus DOT com

When using MSDOS-style pathnames with a #line directive, the path
separator \ is being treated as the escape character.  This is
different from the way MSDOS pathnames used by the #include directive
are preprocessed.

Example:

The following simple C code:

#include "C:\home\Administrator\temp.h"
#include "\home\Administrator\temp2.h"

int main()
{
#line 255 "C:\home\Administrator\temp.h"
  printf( STRING );
#line 255 "\home\Administrator\temp.h"
  return( 0 );
}

Preprocesses (using gcc -E) to:

# 1 "C:\\home\\Administrator\\temp.h" 1

# 2 "temp.c" 2

# 1 "\\home\\Administrator\\temp2.h" 1

# 3 "temp.c" 2


int main()
{
# 254 "C:homeAdministrator\011emp.h"    <<<<<BUG!

  printf( "Hello, Planet!\n"  );
# 254 "homeAdministrator\011emp.h"      <<<<<BUG!

  return( 0 );
}


When including the files temp.h and temp2.h using the MSDOS pathname
format, the preprocessor correctly escapes the path separators.  
However, when using the #line directive (see <<<<<BUG! above), the
pathname separator is treated as an escape, which results in an
invalid path.

Seems to me that #line should act line #include does.  At the very
least, they should be consistent.

Please excuse me if this issue has already been addressed, I didn't
see it on the FAQ, and I've yet to join the mailing list....

-- K
______________________________________________________________________
Kenneth A. Giusti                  Agranat Systems, Inc.
Principal Software Engineer        1345 Main Street, Waltham MA 02154
giusti AT agranat DOT com                 (617) 893-7868  x32

 ** Specialists in Data Communications/Embedded Systems Development **
                     http://www.agranat.com

-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019