#include "parser-defs.h"
#include "language.h"
#include "c-lang.h"
+#include "c-support.h"
#include "bfd.h" /* Required by objfiles.h. */
#include "symfile.h" /* Required by objfiles.h. */
#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
static int yylex (void);
-void yyerror (const char *);
+static void yyerror (const char *);
static int type_aggregate_p (struct type *);
%token <ssym> NAME_OR_INT
%token OPERATOR
-%token STRUCT CLASS UNION ENUM SIZEOF UNSIGNED COLONCOLON
+%token STRUCT CLASS UNION ENUM SIZEOF ALIGNOF UNSIGNED COLONCOLON
%token TEMPLATE
%token ERROR
%token NEW DELETE
{ write_exp_elt_opcode (pstate, UNOP_SIZEOF); }
;
+exp : ALIGNOF '(' type_exp ')' %prec UNARY
+ { write_exp_elt_opcode (pstate, UNOP_ALIGNOF); }
+ ;
+
exp : exp ARROW name
{ write_exp_elt_opcode (pstate, STRUCTOP_PTR);
write_exp_string (pstate, $3);
if (symbol_read_needs_frame (sym.symbol))
innermost_block.update (sym);
- write_exp_elt_opcode (pstate, OP_VAR_VALUE);
- write_exp_elt_block (pstate, sym.block);
- write_exp_elt_sym (pstate, sym.symbol);
- write_exp_elt_opcode (pstate, OP_VAR_VALUE);
+ /* If we found a function, see if it's
+ an ifunc resolver that has the same
+ address as the ifunc symbol itself.
+ If so, prefer the ifunc symbol. */
+
+ bound_minimal_symbol resolver
+ = find_gnu_ifunc (sym.symbol);
+ if (resolver.minsym != NULL)
+ write_exp_msymbol (pstate, resolver);
+ else
+ {
+ write_exp_elt_opcode (pstate, OP_VAR_VALUE);
+ write_exp_elt_block (pstate, sym.block);
+ write_exp_elt_sym (pstate, sym.symbol);
+ write_exp_elt_opcode (pstate, OP_VAR_VALUE);
+ }
}
else if ($1.is_a_field_of_this)
{
is important for example for "p
*__errno_location()". */
symbol *alias_target
- = (msymbol.minsym->type != mst_text_gnu_ifunc
+ = ((msymbol.minsym->type != mst_text_gnu_ifunc
+ && msymbol.minsym->type != mst_data_gnu_ifunc)
? find_function_alias_target (msymbol)
: NULL);
if (alias_target != NULL)
len -= 2;
}
/* Handle suffixes: 'f' for float, 'l' for long double. */
- else if (len >= 1 && tolower (p[len - 1]) == 'f')
+ else if (len >= 1 && TOLOWER (p[len - 1]) == 'f')
{
putithere->typed_val_float.type
= parse_type (par_state)->builtin_float;
len -= 1;
}
- else if (len >= 1 && tolower (p[len - 1]) == 'l')
+ else if (len >= 1 && TOLOWER (p[len - 1]) == 'l')
{
putithere->typed_val_float.type
= parse_type (par_state)->builtin_long_double;
if (output)
obstack_grow_str (output, "\\x");
++tokptr;
- if (!isxdigit (*tokptr))
+ if (!ISXDIGIT (*tokptr))
error (_("\\x escape without a following hex digit"));
- while (isxdigit (*tokptr))
+ while (ISXDIGIT (*tokptr))
{
if (output)
obstack_1grow (output, *tokptr);
if (output)
obstack_grow_str (output, "\\");
for (i = 0;
- i < 3 && isdigit (*tokptr) && *tokptr != '8' && *tokptr != '9';
+ i < 3 && ISDIGIT (*tokptr) && *tokptr != '8' && *tokptr != '9';
++i)
{
if (output)
obstack_1grow (output, *tokptr);
}
++tokptr;
- if (!isxdigit (*tokptr))
+ if (!ISXDIGIT (*tokptr))
error (_("\\%c escape without a following hex digit"), c);
- for (i = 0; i < len && isxdigit (*tokptr); ++i)
+ for (i = 0; i < len && ISXDIGIT (*tokptr); ++i)
{
if (output)
obstack_1grow (output, *tokptr);
{"struct", STRUCT, OP_NULL, 0},
{"signed", SIGNED_KEYWORD, OP_NULL, 0},
{"sizeof", SIZEOF, OP_NULL, 0},
+ {"_Alignof", ALIGNOF, OP_NULL, 0},
+ {"alignof", ALIGNOF, OP_NULL, FLAG_CXX},
{"double", DOUBLE_KEYWORD, OP_NULL, 0},
{"false", FALSEKEYWORD, OP_NULL, FLAG_CXX},
{"class", CLASS, OP_NULL, FLAG_CXX},
last_was_structop = true;
goto symbol; /* Nope, must be a symbol. */
}
- /* FALL THRU into number case. */
+ /* FALL THRU. */
case '0':
case '1':
size_t len = strlen ("selector");
if (strncmp (p, "selector", len) == 0
- && (p[len] == '\0' || isspace (p[len])))
+ && (p[len] == '\0' || ISSPACE (p[len])))
{
lexptr = p + len;
return SELECTOR;
goto parse_string;
}
- while (isspace (*p))
+ while (ISSPACE (*p))
p++;
- if (strncmp (p, "entry", len) == 0 && !isalnum (p[len])
+ if (strncmp (p, "entry", len) == 0 && !c_ident_is_alnum (p[len])
&& p[len] != '_')
{
lexptr = &p[len];
}
}
- if (!(c == '_' || c == '$'
- || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
+ if (!(c == '_' || c == '$' || c_ident_is_alpha (c)))
/* We must have come across a bad character (e.g. ';'). */
error (_("Invalid character '%c' in expression."), c);
/* It's a name. See how long it is. */
namelen = 0;
for (c = tokstart[namelen];
- (c == '_' || c == '$' || (c >= '0' && c <= '9')
- || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '<');)
+ (c == '_' || c == '$' || c_ident_is_alnum (c) || c == '<');)
{
/* Template parameter lists are part of the name.
FIXME: This mishandles `print $a<4&&$a>3'. */
#endif
-void
+static void
yyerror (const char *msg)
{
if (prev_lexptr)
lexptr = prev_lexptr;
- error (_("A %s in expression, near `%s'."), (msg ? msg : "error"), lexptr);
+ error (_("A %s in expression, near `%s'."), msg, lexptr);
}