HP merge changes by eepstein and ezannoni; added external flag
hp_som_som_object_present; added true and false tokens; changed some of the template processing code for handling HP aCC templates.
This commit is contained in:
parent
ed12a885a3
commit
3473370194
2 changed files with 118 additions and 32 deletions
|
@ -1,3 +1,16 @@
|
||||||
|
Wed Jan 6 11:43:32 1999 David Taylor <taylor@texas.cygnus.com>
|
||||||
|
|
||||||
|
The following changes were made by Elena Zannoni
|
||||||
|
<ezannoni@cygnus.com> and Edith Epstein <eepstein@cygnus.com> as
|
||||||
|
part of a project to merge in changes made by HP.
|
||||||
|
|
||||||
|
* c-exp.y: use external flag hp_som_som_object_present to decide
|
||||||
|
whether code was compiled by HP's compilers. Add two new C++
|
||||||
|
tokens for true and false.
|
||||||
|
(yylex): check for template name is done differently for the
|
||||||
|
HP/aCC compiler case. Change some of the template processing code
|
||||||
|
for handling HP aCC templates. Handle true and false tokens.
|
||||||
|
|
||||||
Tue Jan 5 11:13:36 1999 Michael Snyder <msnyder@cleaver.cygnus.com>
|
Tue Jan 5 11:13:36 1999 Michael Snyder <msnyder@cleaver.cygnus.com>
|
||||||
|
|
||||||
* remote.c (record_curthread): Must not modify inferior_pid when
|
* remote.c (record_curthread): Must not modify inferior_pid when
|
||||||
|
|
81
gdb/c-exp.y
81
gdb/c-exp.y
|
@ -49,6 +49,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
#include "symfile.h" /* Required by objfiles.h. */
|
#include "symfile.h" /* Required by objfiles.h. */
|
||||||
#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
|
#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
|
||||||
|
|
||||||
|
/* Flag indicating we're dealing with HP-compiled objects */
|
||||||
|
extern int hp_som_som_object_present;
|
||||||
|
|
||||||
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
|
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
|
||||||
as well as gratuitiously global symbol names, so we can have multiple
|
as well as gratuitiously global symbol names, so we can have multiple
|
||||||
yacc generated parsers in gdb. Note that these are only the variables
|
yacc generated parsers in gdb. Note that these are only the variables
|
||||||
|
@ -195,6 +198,9 @@ parse_number PARAMS ((char *, int, int, YYSTYPE *));
|
||||||
|
|
||||||
/* C++ */
|
/* C++ */
|
||||||
%token THIS
|
%token THIS
|
||||||
|
%token TRUEKEYWORD
|
||||||
|
%token FALSEKEYWORD
|
||||||
|
|
||||||
|
|
||||||
%left ','
|
%left ','
|
||||||
%left ABOVE_COMMA
|
%left ABOVE_COMMA
|
||||||
|
@ -289,6 +295,7 @@ exp : exp ARROW qualified_name
|
||||||
write_exp_elt_opcode (UNOP_ADDR);
|
write_exp_elt_opcode (UNOP_ADDR);
|
||||||
write_exp_elt_opcode (STRUCTOP_MPTR); }
|
write_exp_elt_opcode (STRUCTOP_MPTR); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp : exp ARROW '*' exp
|
exp : exp ARROW '*' exp
|
||||||
{ write_exp_elt_opcode (STRUCTOP_MPTR); }
|
{ write_exp_elt_opcode (STRUCTOP_MPTR); }
|
||||||
;
|
;
|
||||||
|
@ -528,6 +535,20 @@ exp : THIS
|
||||||
write_exp_elt_opcode (OP_THIS); }
|
write_exp_elt_opcode (OP_THIS); }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
exp : TRUEKEYWORD
|
||||||
|
{ write_exp_elt_opcode (OP_LONG);
|
||||||
|
write_exp_elt_type (builtin_type_bool);
|
||||||
|
write_exp_elt_longcst ((LONGEST) 1);
|
||||||
|
write_exp_elt_opcode (OP_LONG); }
|
||||||
|
;
|
||||||
|
|
||||||
|
exp : FALSEKEYWORD
|
||||||
|
{ write_exp_elt_opcode (OP_LONG);
|
||||||
|
write_exp_elt_type (builtin_type_bool);
|
||||||
|
write_exp_elt_longcst ((LONGEST) 0);
|
||||||
|
write_exp_elt_opcode (OP_LONG); }
|
||||||
|
;
|
||||||
|
|
||||||
/* end of C++. */
|
/* end of C++. */
|
||||||
|
|
||||||
block : BLOCKNAME
|
block : BLOCKNAME
|
||||||
|
@ -822,6 +843,9 @@ typebase /* Implements (approximately): (type-qualifier)* type-specifier */
|
||||||
{ $$ = lookup_signed_typename (TYPE_NAME($2.type)); }
|
{ $$ = lookup_signed_typename (TYPE_NAME($2.type)); }
|
||||||
| SIGNED_KEYWORD
|
| SIGNED_KEYWORD
|
||||||
{ $$ = builtin_type_int; }
|
{ $$ = builtin_type_int; }
|
||||||
|
/* It appears that this rule for templates is never
|
||||||
|
reduced; template recognition happens by lookahead
|
||||||
|
in the token processing code in yylex. */
|
||||||
| TEMPLATE name '<' type '>'
|
| TEMPLATE name '<' type '>'
|
||||||
{ $$ = lookup_template_type(copy_name($2), $4,
|
{ $$ = lookup_template_type(copy_name($2), $4,
|
||||||
expression_context_block);
|
expression_context_block);
|
||||||
|
@ -1163,9 +1187,15 @@ yylex ()
|
||||||
int tempbufindex;
|
int tempbufindex;
|
||||||
static char *tempbuf;
|
static char *tempbuf;
|
||||||
static int tempbufsize;
|
static int tempbufsize;
|
||||||
|
struct symbol * sym_class = NULL;
|
||||||
|
char * token_string = NULL;
|
||||||
|
int class_prefix = 0;
|
||||||
|
int unquoted_expr;
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
|
|
||||||
|
unquoted_expr = 1;
|
||||||
|
|
||||||
tokstart = lexptr;
|
tokstart = lexptr;
|
||||||
/* See if it is a special token of length 3. */
|
/* See if it is a special token of length 3. */
|
||||||
for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
|
for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
|
||||||
|
@ -1217,6 +1247,7 @@ yylex ()
|
||||||
if (namelen > 2)
|
if (namelen > 2)
|
||||||
{
|
{
|
||||||
lexptr = tokstart + namelen;
|
lexptr = tokstart + namelen;
|
||||||
|
unquoted_expr = 0;
|
||||||
if (lexptr[-1] != '\'')
|
if (lexptr[-1] != '\'')
|
||||||
error ("Unmatched single quote.");
|
error ("Unmatched single quote.");
|
||||||
namelen -= 2;
|
namelen -= 2;
|
||||||
|
@ -1405,6 +1436,20 @@ yylex ()
|
||||||
FIXME: This mishandles `print $a<4&&$a>3'. */
|
FIXME: This mishandles `print $a<4&&$a>3'. */
|
||||||
|
|
||||||
if (c == '<')
|
if (c == '<')
|
||||||
|
{
|
||||||
|
if (hp_som_som_object_present)
|
||||||
|
{
|
||||||
|
/* Scan ahead to get rest of the template specification. Note
|
||||||
|
that we look ahead only when the '<' adjoins non-whitespace
|
||||||
|
characters; for comparison expressions, e.g. "a < b > c",
|
||||||
|
there must be spaces before the '<', etc. */
|
||||||
|
|
||||||
|
char * p = find_template_name_end (tokstart + namelen);
|
||||||
|
if (p)
|
||||||
|
namelen = p - tokstart;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
int i = namelen;
|
int i = namelen;
|
||||||
int nesting_level = 1;
|
int nesting_level = 1;
|
||||||
|
@ -1423,6 +1468,7 @@ yylex ()
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
c = tokstart[++namelen];
|
c = tokstart[++namelen];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1460,9 +1506,13 @@ yylex ()
|
||||||
return DOUBLE_KEYWORD;
|
return DOUBLE_KEYWORD;
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
if (current_language->la_language == language_cplus
|
if (current_language->la_language == language_cplus)
|
||||||
&& STREQN (tokstart, "class", 5))
|
{
|
||||||
|
if (STREQN (tokstart, "false", 5))
|
||||||
|
return FALSEKEYWORD;
|
||||||
|
if (STREQN (tokstart, "class", 5))
|
||||||
return CLASS;
|
return CLASS;
|
||||||
|
}
|
||||||
if (STREQN (tokstart, "union", 5))
|
if (STREQN (tokstart, "union", 5))
|
||||||
return UNION;
|
return UNION;
|
||||||
if (STREQN (tokstart, "short", 5))
|
if (STREQN (tokstart, "short", 5))
|
||||||
|
@ -1475,8 +1525,12 @@ yylex ()
|
||||||
return ENUM;
|
return ENUM;
|
||||||
if (STREQN (tokstart, "long", 4))
|
if (STREQN (tokstart, "long", 4))
|
||||||
return LONG;
|
return LONG;
|
||||||
if (current_language->la_language == language_cplus
|
if (current_language->la_language == language_cplus)
|
||||||
&& STREQN (tokstart, "this", 4))
|
{
|
||||||
|
if (STREQN (tokstart, "true", 4))
|
||||||
|
return TRUEKEYWORD;
|
||||||
|
|
||||||
|
if (STREQN (tokstart, "this", 4))
|
||||||
{
|
{
|
||||||
static const char this_name[] =
|
static const char this_name[] =
|
||||||
{ CPLUS_MARKER, 't', 'h', 'i', 's', '\0' };
|
{ CPLUS_MARKER, 't', 'h', 'i', 's', '\0' };
|
||||||
|
@ -1486,6 +1540,7 @@ yylex ()
|
||||||
(struct symtab **) NULL))
|
(struct symtab **) NULL))
|
||||||
return THIS;
|
return THIS;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
if (STREQN (tokstart, "int", 3))
|
if (STREQN (tokstart, "int", 3))
|
||||||
|
@ -1504,6 +1559,24 @@ yylex ()
|
||||||
return VARIABLE;
|
return VARIABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Look ahead and see if we can consume more of the input
|
||||||
|
string to get a reasonable class/namespace spec or a
|
||||||
|
fully-qualified name. This is a kludge to get around the
|
||||||
|
HP aCC compiler's generation of symbol names with embedded
|
||||||
|
colons for namespace and nested classes. */
|
||||||
|
if (unquoted_expr)
|
||||||
|
{
|
||||||
|
/* Only do it if not inside single quotes */
|
||||||
|
sym_class = parse_nested_classes_for_hpacc (yylval.sval.ptr, yylval.sval.length,
|
||||||
|
&token_string, &class_prefix, &lexptr);
|
||||||
|
if (sym_class)
|
||||||
|
{
|
||||||
|
/* Replace the current token with the bigger one we found */
|
||||||
|
yylval.sval.ptr = token_string;
|
||||||
|
yylval.sval.length = strlen (token_string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Use token-type BLOCKNAME for symbols that happen to be defined as
|
/* Use token-type BLOCKNAME for symbols that happen to be defined as
|
||||||
functions or symtabs. If this is not so, then ...
|
functions or symtabs. If this is not so, then ...
|
||||||
Use token-type TYPENAME for symbols that happen to be defined
|
Use token-type TYPENAME for symbols that happen to be defined
|
||||||
|
|
Loading…
Add table
Reference in a new issue