X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fada-lex.l;h=ce8de69f8e3fee17edc8b300ae912ea4336b5ae9;hb=edd079d9f6ca2f9ad21322b742269aec5de61190;hp=c50f5a83bdb67fe817869d601ee83e6431dfe27c;hpb=6d3d12ebef6fa7dd6bc8c34fbc5e440ac8d0a8c6;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/ada-lex.l b/gdb/ada-lex.l index c50f5a83bd..ce8de69f8e 100644 --- a/gdb/ada-lex.l +++ b/gdb/ada-lex.l @@ -1,5 +1,5 @@ /* FLEX lexer for Ada expressions, for GDB. - Copyright (C) 1994-2014 Free Software Foundation, Inc. + Copyright (C) 1994-2017 Free Software Foundation, Inc. This file is part of GDB. @@ -41,6 +41,14 @@ POSEXP (e"+"?{NUM10}) %{ +#include "common/diagnostics.h" + +/* Some old versions of flex generate code that uses the "register" keyword, + which clang warns about. This was observed for example with flex 2.5.35, + as shipped with macOS 10.12. */ +DIAGNOSTIC_PUSH +DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER + #define NUMERAL_WIDTH 256 #define LONGEST_SIGN ((ULONGEST) 1 << (sizeof(LONGEST) * HOST_CHAR_BIT - 1)) @@ -205,7 +213,7 @@ false { return FALSEKEYWORD; } /* ATTRIBUTES */ -{TICK}[a-zA-Z][a-zA-Z]+ { return processAttribute (yytext+1); } +{TICK}[a-zA-Z][a-zA-Z]+ { BEGIN INITIAL; return processAttribute (yytext+1); } /* PUNCTUATION */ @@ -395,16 +403,12 @@ processInt (struct parser_state *par_state, const char *base0, static int processReal (struct parser_state *par_state, const char *num0) { - sscanf (num0, "%" DOUBLEST_SCAN_FORMAT, &yylval.typed_val_float.dval); - - yylval.typed_val_float.type = type_float (par_state); - if (sizeof(DOUBLEST) >= gdbarch_double_bit (parse_gdbarch (par_state)) - / TARGET_CHAR_BIT) - yylval.typed_val_float.type = type_double (par_state); - if (sizeof(DOUBLEST) >= gdbarch_long_double_bit (parse_gdbarch (par_state)) - / TARGET_CHAR_BIT) - yylval.typed_val_float.type = type_long_double (par_state); + yylval.typed_val_float.type = type_long_double (par_state); + bool parsed = parse_float (num0, strlen (num0), + yylval.typed_val_float.type, + yylval.typed_val_float.val); + gdb_assert (parsed); return FLOAT; } @@ -428,7 +432,7 @@ processReal (struct parser_state *par_state, const char *num0) static struct stoken processId (const char *name0, int len) { - char *name = obstack_alloc (&temp_parse_space, len + 11); + char *name = (char *) obstack_alloc (&temp_parse_space, len + 11); int i0, i; struct stoken result; @@ -499,7 +503,7 @@ processString (const char *text, int len) const char *lim = text + len; struct stoken result; - q = obstack_alloc (&temp_parse_space, len); + q = (char *) obstack_alloc (&temp_parse_space, len); result.ptr = q; p = text; while (p < lim) @@ -648,3 +652,5 @@ dummy_function ada_flex_use[] = { (dummy_function) yyunput }; + +DIAGNOSTIC_POP