Article View: gnu.g++.bug
Article #577rindex/strrchr in cplus-lex.c
From: jonathan
Date: Tue, 14 Nov 1989 03:34
Date: Tue, 14 Nov 1989 03:34
74 lines
2758 bytes
2758 bytes
A properly configured g++-1.36.1 fails to build cc1plus on a Pyramid 90x.
_strrchr is undefined.
cplus-lex.c from 1.36.1 assumes that all machines fall into two
classes: (i) those that have system V string/memory functions, and
(ii) those that are sequents. :-)
Other systems based on 4.2bsd (such as many vendor-supplied systems)
do not have the 4.3bsd compatibility routines (or ANSI C libraries),
and therefore do not have str[r]chr or memcpy.
Associated GNU software (gcc, emacs, binutils) consistently uses BSD string
functions (index, rindex), and defines them to be their SystemV
equivalents on USG machines. The following diff makes cplus-lex.c adhere
to this convention.
*** /usr/src/gnu/g++-1.36.1/cplus-lex.c Fri Nov 3 20:14:34 1989
--- ./cplus-lex.c Tue Nov 14 16:16:23 1989
***************
*** 45,50 ****
--- 45,55 ----
extern double atof ();
+ #ifdef USG
+ #define index strchr
+ #define rindex strrchr
+ #endif /* USG */
+
/* This obstack is needed to hold text. It is not safe to use
TOKEN_BUFFER because `check_newline' calls `yylex'. */
static struct obstack inline_text_obstack;
***************
*** 766,776 ****
/* Our only interest is _ref and _expr. */
if (tree_code_type[i][0] == 'r' || tree_code_type[i][0] == 'e')
{
- #if defined (sequent)
char *end = (char *)rindex (tree_code_name[i], '_');
- #else
- char *end = (char *)strrchr (tree_code_name[i], '_');
- #endif
if (end)
opname_end[i] = end - tree_code_name[i];
}
--- 771,777 ----
***************
*** 1481,1495 ****
if (c == '\n')
{
char *tmp;
! extern char* rindex(), *strrchr ();
strcpy (dump_file_name, "dumped-");
- #if defined (sequent)
if (tmp = rindex (dump_source_name, '/'))
dump_source_name = tmp + 1;
- #else
- if (tmp = strrchr (dump_source_name, '/'))
- dump_source_name = tmp + 1;
- #endif
strcat (dump_file_name, dump_source_name);
}
else
--- 1482,1491 ----
if (c == '\n')
{
char *tmp;
! extern char* rindex();
strcpy (dump_file_name, "dumped-");
if (tmp = rindex (dump_source_name, '/'))
dump_source_name = tmp + 1;
strcat (dump_file_name, dump_source_name);
}
else
Technical Details
Message-ID:
<8911140334.AA19118@comp.vuw.ac.nz>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!shelby!apple!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!comp.vuw.ac.nz!jonathanShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!shelby!apple!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!comp.vuw.ac.nz!jonathan From: jonathan@comp.vuw.ac.nz Newsgroups: gnu.g++.bug Subject: rindex/strrchr in cplus-lex.c Message-ID: <8911140334.AA19118@comp.vuw.ac.nz> Date: 14 Nov 89 03:34:14 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 74