* [patch/testsuite] compiler.cc, compiler.c: work with old hp acc
@ 2004-06-30 7:59 Michael Elizabeth Chastain
2004-06-30 13:11 ` Daniel Jacobowitz
0 siblings, 1 reply; 3+ messages in thread
From: Michael Elizabeth Chastain @ 2004-06-30 7:59 UTC (permalink / raw)
To: gdb-patches
This is a one-line patch to make the test suite run with old hp aC++
compilers. I recently switched to an older hpux and I got hurt by this.
This happens with hp aC++ A.03.13 but is fixed in hp aCC A.03.45.
lib/compiler.cc says:
set compiler_info "unknown"
#if foo
...
#endif
#if defined (_HP_aCC)
blah blah blah
#endif
The hp aC++ preprocessor emits:
set compiler_info "unknown"blah blah blah
That's right, it eats the newline! This gives lib/gdb.exp indigestion
because it's eval'ing this output as tcl commands.
After some experimentation and cursing, it looks like their compiler
does aggressive string concatenation. If the last token in the line is
a string, then the preprocessor eats the newline in order to merge with
the first token on the next line, in case that token is a string.
The patch is simple: add another token at the end of the line, like a
semicolon. That makes the preprocessor respect the newlines.
Tested on:
native i686-pc-linux-gnu, gcc 2.95.3 3.3.3 3.4.0, dwarf-2 stabs+
native hppa2.0w-hp-hpux11.00, hp ansi c A.11.01.25171.GP,
hp aC++ A.03.13
I don't have access to the newer hp aC++ (A.03.45) but since this
works with A.03.13 it should work with A.03.45.
I am committing this now,
Michael C
2004-06-30 Michael Chastain <mec.gnu@mindspring.com>
* lib/compiler.cc: Work around string preprocessing problem
with old hp c++ compiler.
* lib/compiler.c: Likewise.
Index: lib/compiler.cc
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/compiler.cc,v
retrieving revision 1.7
diff -c -3 -p -r1.7 compiler.cc
*** lib/compiler.cc 14 Jun 2004 15:29:30 -0000 1.7
--- lib/compiler.cc 30 Jun 2004 06:10:01 -0000
***************
*** 22,28 ****
/* This file is exactly like compiler.c. I could just use compiler.c if
I could be sure that every C++ compiler accepted extensions of ".c". */
! set compiler_info "unknown"
#if defined (__GNUC__)
#if defined (__GNUC_PATCHLEVEL__)
--- 22,35 ----
/* This file is exactly like compiler.c. I could just use compiler.c if
I could be sure that every C++ compiler accepted extensions of ".c". */
! /* Note the semicolon at the end of this line. Older versions of
! hp c++ have a bug in string preprocessing: if the last token on a
! line is a string, then the preprocessor concatenates the next line
! onto the current line and eats the newline! That messes up TCL of
! course. That happens with HP aC++ A.03.13, but it no longer happens
! with HP aC++ A.03.45. */
!
! set compiler_info "unknown" ;
#if defined (__GNUC__)
#if defined (__GNUC_PATCHLEVEL__)
Index: lib/compiler.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/compiler.c,v
retrieving revision 1.5
diff -c -3 -p -r1.5 compiler.c
*** lib/compiler.c 14 Jun 2004 15:29:30 -0000 1.5
--- lib/compiler.c 30 Jun 2004 06:10:01 -0000
***************
*** 34,40 ****
TODO: purge signed_keyword_not_used. */
! set compiler_info "unknown"
#if defined (__GNUC__)
#if defined (__GNUC_PATCHLEVEL__)
--- 34,47 ----
TODO: purge signed_keyword_not_used. */
! /* Note the semicolon at the end of this line. Older versions of
! hp c++ have a bug in string preprocessing: if the last token on a
! line is a string, then the preprocessor concatenates the next line
! onto the current line and eats the newline! That messes up TCL of
! course. That happens with HP aC++ A.03.13, but it no longer happens
! with HP aC++ A.03.45. */
!
! set compiler_info "unknown" ;
#if defined (__GNUC__)
#if defined (__GNUC_PATCHLEVEL__)
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [patch/testsuite] compiler.cc, compiler.c: work with old hp acc
2004-06-30 7:59 [patch/testsuite] compiler.cc, compiler.c: work with old hp acc Michael Elizabeth Chastain
@ 2004-06-30 13:11 ` Daniel Jacobowitz
0 siblings, 0 replies; 3+ messages in thread
From: Daniel Jacobowitz @ 2004-06-30 13:11 UTC (permalink / raw)
To: Michael Elizabeth Chastain; +Cc: gdb-patches
On Wed, Jun 30, 2004 at 03:59:39AM -0400, Michael Chastain wrote:
> After some experimentation and cursing, it looks like their compiler
> does aggressive string concatenation. If the last token in the line is
> a string, then the preprocessor eats the newline in order to merge with
> the first token on the next line, in case that token is a string.
THANK you! I ran into this recently and couldn't figure out what the
problem was.
There's also some option you can pass to aCC to stop it from doing this
- there's an ANSI and a non-ANSI preprocessor and you can explicitly
specify the ANSI one.
> ! /* Note the semicolon at the end of this line. Older versions of
> ! hp c++ have a bug in string preprocessing: if the last token on a
> ! line is a string, then the preprocessor concatenates the next line
> ! onto the current line and eats the newline! That messes up TCL of
> ! course. That happens with HP aC++ A.03.13, but it no longer happens
> ! with HP aC++ A.03.45. */
> !
> ! set compiler_info "unknown" ;
>
> #if defined (__GNUC__)
> #if defined (__GNUC_PATCHLEVEL__)
>
I saw this with A.03.37.
--
Daniel Jacobowitz
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch/testsuite] compiler.cc, compiler.c: work with old hp acc
@ 2004-06-30 16:52 Michael Elizabeth Chastain
0 siblings, 0 replies; 3+ messages in thread
From: Michael Elizabeth Chastain @ 2004-06-30 16:52 UTC (permalink / raw)
To: drow, mec.gnu; +Cc: gdb-patches
drow> There's also some option you can pass to aCC to stop it from doing
drow> this - there's an ANSI and a non-ANSI preprocessor and you can
drow> explicitly specify the ANSI one.
I can't find the option in the man page for aCC, but the man page
does mention that there are two preprocessor binaries:
/opt/langtools/lbin/cpp and /opt/langtools/lbin/cpp.ansi.
Some Postgres people ran into this as well. They were using the
preprocessor to generate output that is not C/C++ (which is what we're
doing, actually) and their generated output had constructs such as
"foo" "bar" "bletch", and the hp preprocessor was emitting "foobarbletch".
drow> I saw this with A.03.37.
HP is a handful of problems all right!
Michael C
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-06-30 16:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-30 7:59 [patch/testsuite] compiler.cc, compiler.c: work with old hp acc Michael Elizabeth Chastain
2004-06-30 13:11 ` Daniel Jacobowitz
2004-06-30 16:52 Michael Elizabeth Chastain
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox