Article View: gnu.gcc.bug
Article #1601cpp line directives
From: 07-Jan-1993 1501
Date: Thu, 07 Jan 1993 15:00
Date: Thu, 07 Jan 1993 15:00
118 lines
4547 bytes
4547 bytes
I N T E R O F F I C E M E M O R A N D U M
Date: 07-Jan-1993 02:57pm BST
From: Tim Murnaghan @IME
MURNAGHANT
Dept:
Tel No:
TO: Remote Addressee ( _DECWRL::"BUG-GCC@PREP.AI.MIT.EDU" )
Subject: cpp line directives
A small bug report and a minor usability enhancement.
We find it useful to have a portable ansi pre-processor for other things as
well as C (like for pre-processing Makefiles - as imake does).
"gcc -E -" does not currently work as the suffix length check in gcc is before
the check for "-".
Programs like imake expect the # line number directives to be of a standard
form and so complains about the GNU cc1 specific 1,2,3 bits on the end of them.
The attached patch adds a -L flag to the pre-processor to turn these off, and
gcc uses this flag when used with "-E -".
*** gcc.c.orig Thu Jan 7 14:03:12 1993
--- gcc.c Thu Jan 7 14:42:57 1993
***************
*** 450,455 ****
--- 450,456 ----
%{!pipe:%g.s} %A\n }}}}"},
{"-",
"%{E:cpp -lang-c %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %I\
+ %{E:-L}\
%{C:%{!E:%eGNU C does not support -C without using -E}}\
%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d}\
-undef -D__GNUC__=2 %{ansi:-trigraphs -$ -D__STRICT_ANSI__}\
***************
*** 3589,3595 ****
/* Look for a suffix. */
for (cp = compilers + n_compilers - 1; cp >= compilers; cp--)
{
! if (strlen (cp->suffix) < length
/* See if the suffix matches the end of NAME. */
&& !strcmp (cp->suffix,
name + length - strlen (cp->suffix))
--- 3590,3596 ----
/* Look for a suffix. */
for (cp = compilers + n_compilers - 1; cp >= compilers; cp--)
{
! if ((strlen (cp->suffix) < length || !strcmp(cp->suffix, "-"))
/* See if the suffix matches the end of NAME. */
&& !strcmp (cp->suffix,
name + length - strlen (cp->suffix))
*** cccp.c.orig Thu Jan 7 14:05:25 1993
--- cccp.c Thu Jan 7 14:05:56 1993
***************
*** 363,368 ****
--- 363,369 ----
/* Nonzero means don't output line number information. */
static int no_line_commands;
+ static int normal_line_commands;
/* dump_only means inhibit output of the preprocessed text
and instead output the definitions of all user-defined
***************
*** 1002,1007 ****
--- 1003,1009 ----
dollars_in_ident = DOLLARS_IN_IDENTIFIERS > 0;
no_line_commands = 0;
+ normal_line_commands = 0;
no_trigraphs = 1;
dump_macros = dump_none;
no_output = 0;
***************
*** 1283,1288 ****
--- 1285,1294 ----
no_line_commands = 1;
break;
+ case 'L':
+ normal_line_commands = 1;
+ break;
+
case '$': /* Don't include $ in identifiers. */
dollars_in_ident = 0;
break;
***************
*** 6822,6832 ****
#else
sprintf (line_cmd_buf, "# %d \"%s\"", ip->lineno, ip->nominal_fname);
#endif
! if (file_change != same_file)
! strcat (line_cmd_buf, file_change == enter_file ? " 1" : " 2");
! /* Tell cc1 if following text comes from a system header file. */
! if (ip->system_header_p)
! strcat (line_cmd_buf, " 3");
len = strlen (line_cmd_buf);
line_cmd_buf[len++] = '\n';
check_expand (op, len + 1);
--- 6828,6840 ----
#else
sprintf (line_cmd_buf, "# %d \"%s\"", ip->lineno, ip->nominal_fname);
#endif
! if (normal_line_commands == 0) {
! if (file_change != same_file)
! strcat (line_cmd_buf, file_change == enter_file ? " 1" : " 2");
! /* Tell cc1 if following text comes from a system header file. */
! if (ip->system_header_p)
! strcat (line_cmd_buf, " 3");
! }
len = strlen (line_cmd_buf);
line_cmd_buf[len++] = '\n';
check_expand (op, len + 1);
Technical Details
Message-ID:
<9301071500.AA26300@enet-gw.pa.dec.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!elroy.jpl.nasa.gov!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!uproar.enet.DEc.COM!murnaghantShow Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug Path: arc1-ca.pugleaf.net!sparky!uunet!elroy.jpl.nasa.gov!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!uproar.enet.DEc.COM!murnaghant From: murnaghant@uproar.enet.DEc.COM (07-Jan-1993 1501) Subject: cpp line directives Message-ID: <9301071500.AA26300@enet-gw.pa.dec.com> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Thu, 7 Jan 1993 15:00:32 GMT Approved: bug-gcc@prep.ai.mit.edu Lines: 121