gdb/doc: space out list entries, fix one type
[deliverable/binutils-gdb.git] / gdb / c-exp.y
index e7d0a0dc4ad398f514ccb866b1cd6eb27324c3dc..6225217838d829b09136de19a7bfe651e07da5a8 100644 (file)
@@ -2551,17 +2551,13 @@ static const struct token ident_tokens[] =
 
 
 static void
-scan_macro_expansion (char *expansion)
+scan_macro_expansion (const char *expansion)
 {
-  const char *copy;
-
   /* We'd better not be trying to push the stack twice.  */
   gdb_assert (! cpstate->macro_original_text);
 
-  /* Copy to the obstack, and then free the intermediate
-     expansion.  */
-  copy = obstack_strdup (&cpstate->expansion_obstack, expansion);
-  xfree (expansion);
+  /* Copy to the obstack.  */
+  const char *copy = obstack_strdup (&cpstate->expansion_obstack, expansion);
 
   /* Save the old lexptr value, so we can return to it when we're done
      parsing the expanded text.  */
@@ -2631,12 +2627,11 @@ lex_one_token (struct parser_state *par_state, bool *is_quoted_name)
   /* Check if this is a macro invocation that we need to expand.  */
   if (! scanning_macro_expansion ())
     {
-      char *expanded = macro_expand_next (&pstate->lexptr,
-                                          standard_macro_lookup,
-                                          expression_macro_scope);
+      gdb::unique_xmalloc_ptr<char> expanded
+       = macro_expand_next (&pstate->lexptr, *expression_macro_scope);
 
-      if (expanded)
-        scan_macro_expansion (expanded);
+      if (expanded != nullptr)
+        scan_macro_expansion (expanded.get ());
     }
 
   pstate->prev_lexptr = pstate->lexptr;
@@ -2748,7 +2743,7 @@ lex_one_token (struct parser_state *par_state, bool *is_quoted_name)
     case '9':
       {
        /* It's a number.  */
-       int got_dot = 0, got_e = 0, toktype;
+       int got_dot = 0, got_e = 0, got_p = 0, toktype;
        const char *p = tokstart;
        int hex = input_radix > 10;
 
@@ -2768,13 +2763,16 @@ lex_one_token (struct parser_state *par_state, bool *is_quoted_name)
            /* This test includes !hex because 'e' is a valid hex digit
               and thus does not indicate a floating point number when
               the radix is hex.  */
-           if (!hex && !got_e && (*p == 'e' || *p == 'E'))
+           if (!hex && !got_e && !got_p && (*p == 'e' || *p == 'E'))
              got_dot = got_e = 1;
+           else if (!got_e && !got_p && (*p == 'p' || *p == 'P'))
+             got_dot = got_p = 1;
            /* This test does not include !hex, because a '.' always indicates
               a decimal floating point number regardless of the radix.  */
            else if (!got_dot && *p == '.')
              got_dot = 1;
-           else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
+           else if (((got_e && (p[-1] == 'e' || p[-1] == 'E'))
+                     || (got_p && (p[-1] == 'p' || p[-1] == 'P')))
                     && (*p == '-' || *p == '+'))
              /* This is the sign of the exponent, not the end of the
                 number.  */
@@ -2787,7 +2785,7 @@ lex_one_token (struct parser_state *par_state, bool *is_quoted_name)
              break;
          }
        toktype = parse_number (par_state, tokstart, p - tokstart,
-                               got_dot|got_e, &yylval);
+                               got_dot | got_e | got_p, &yylval);
         if (toktype == ERROR)
          {
            char *err_copy = (char *) alloca (p - tokstart + 1);
@@ -3015,7 +3013,7 @@ static int popping;
 
 /* Temporary storage for c_lex; this holds symbol names as they are
    built up.  */
-auto_obstack name_obstack;
+static auto_obstack name_obstack;
 
 /* Classify a NAME token.  The contents of the token are in `yylval'.
    Updates yylval and returns the new token type.  BLOCK is the block
@@ -3038,7 +3036,7 @@ classify_name (struct parser_state *par_state, const struct block *block,
   memset (&is_a_field_of_this, 0, sizeof (is_a_field_of_this));
 
   bsym = lookup_symbol (copy.c_str (), block, VAR_DOMAIN,
-                       par_state->language ()->la_name_of_this
+                       par_state->language ()->name_of_this ()
                        ? &is_a_field_of_this : NULL);
 
   if (bsym.symbol && SYMBOL_CLASS (bsym.symbol) == LOC_BLOCK)
This page took 0.024912 seconds and 4 git commands to generate.