Split size in regset section iterators
[deliverable/binutils-gdb.git] / gdb / c-exp.y
index 8dc3c068a5e2a8d2d66ba8096d16aaa53ac773e2..a9ccbdcb65e1f8428e1fd0d4d165e5f1dc283cc7 100644 (file)
@@ -42,6 +42,7 @@
 #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 */
@@ -69,7 +70,7 @@ int yyparse (void);
 
 static int yylex (void);
 
-void yyerror (const char *);
+static void yyerror (const char *);
 
 static int type_aggregate_p (struct type *);
 
@@ -173,7 +174,7 @@ static void c_print_token (FILE *file, int type, YYSTYPE value);
 %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
@@ -307,6 +308,10 @@ exp        :       SIZEOF exp       %prec UNARY
                        { 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);
@@ -1041,10 +1046,22 @@ variable:       name_not_typename
                              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)
                            {
@@ -1081,7 +1098,10 @@ variable:        name_not_typename
                                 is important for example for "p
                                 *__errno_location()".  */
                              symbol *alias_target
-                               = find_function_alias_target (msymbol);
+                               = ((msymbol.minsym->type != mst_text_gnu_ifunc
+                                   && msymbol.minsym->type != mst_data_gnu_ifunc)
+                                  ? find_function_alias_target (msymbol)
+                                  : NULL);
                              if (alias_target != NULL)
                                {
                                  write_exp_elt_opcode (pstate, OP_VAR_VALUE);
@@ -1787,13 +1807,13 @@ parse_number (struct parser_state *par_state,
          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;
@@ -2004,9 +2024,9 @@ c_parse_escape (const char **ptr, struct obstack *output)
       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);
@@ -2029,7 +2049,7 @@ c_parse_escape (const char **ptr, struct obstack *output)
        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)
@@ -2054,9 +2074,9 @@ c_parse_escape (const char **ptr, struct obstack *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);
@@ -2314,6 +2334,8 @@ static const struct token ident_tokens[] =
     {"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},
@@ -2571,7 +2593,7 @@ lex_one_token (struct parser_state *par_state, bool *is_quoted_name)
          last_was_structop = true;
          goto symbol;          /* Nope, must be a symbol. */
        }
-      /* FALL THRU into number case.  */
+      /* FALL THRU.  */
 
     case '0':
     case '1':
@@ -2647,7 +2669,7 @@ lex_one_token (struct parser_state *par_state, bool *is_quoted_name)
            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;
@@ -2656,9 +2678,9 @@ lex_one_token (struct parser_state *par_state, bool *is_quoted_name)
              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];
@@ -2720,16 +2742,14 @@ lex_one_token (struct parser_state *par_state, bool *is_quoted_name)
       }
     }
 
-  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'.  */
@@ -3314,11 +3334,11 @@ c_print_token (FILE *file, int type, YYSTYPE value)
 
 #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);
 }
This page took 0.029237 seconds and 4 git commands to generate.