X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=binutils%2Fnlmheader.y;h=e08bf4f84714fae690126b95fec278ad20dae78a;hb=128e85e3ab36b8e30f6612fb50de3cbb4ede6824;hp=5d83f31fcb2b299fcefe3a05e93dda80845dfae7;hpb=3882b010780ca1aa1ed5d7b38e936cd2d6d5486b;p=deliverable%2Fbinutils-gdb.git diff --git a/binutils/nlmheader.y b/binutils/nlmheader.y index 5d83f31fcb..e08bf4f847 100644 --- a/binutils/nlmheader.y +++ b/binutils/nlmheader.y @@ -1,21 +1,22 @@ %{/* nlmheader.y - parse NLM header specification keywords. - Copyright 1993, 1994, 1995, 1997, 1998, 2001 Free Software Foundation, Inc. + Copyright (C) 1993-2016 Free Software Foundation, Inc. -This file is part of GNU Binutils. + This file is part of GNU Binutils. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, + MA 02110-1301, USA. */ /* Written by Ian Lance Taylor . @@ -26,13 +27,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ This implementation is based on the description in the NetWare Tool Maker Specification manual, edition 1.0. */ -#include -#include +#include "sysdep.h" #include "safe-ctype.h" #include "bfd.h" -#include "bucomm.h" #include "nlm/common.h" #include "nlm/internal.h" +#include "bucomm.h" #include "nlmconv.h" /* Information is stored in the structures pointed to by these @@ -49,7 +49,7 @@ char *check_procedure; /* File named by CUSTOM. */ char *custom_file; /* Whether to generate debugging information (DEBUG). */ -boolean debug_info; +bfd_boolean debug_info; /* Procedure named by EXIT. */ char *exit_procedure; /* Exported symbols (EXPORT). */ @@ -59,7 +59,7 @@ struct string_list *input_files; /* Map file name (MAP, FULLMAP). */ char *map_file; /* Whether a full map has been requested (FULLMAP). */ -boolean full_map; +bfd_boolean full_map; /* File named by HELP. */ char *help_file; /* Imported symbols (IMPORT). */ @@ -75,7 +75,7 @@ char *sharelib_file; /* Start procedure name (START). */ char *start_procedure; /* VERBOSE. */ -boolean verbose; +bfd_boolean verbose; /* RPC description file (XDCDATA). */ char *rpc_file; @@ -90,22 +90,21 @@ static char *symbol_prefix; #define yyerror(msg) nlmheader_error (msg); /* Local functions. */ -static int yylex PARAMS ((void)); -static void nlmlex_file_push PARAMS ((const char *)); -static boolean nlmlex_file_open PARAMS ((const char *)); -static int nlmlex_buf_init PARAMS ((void)); -static char nlmlex_buf_add PARAMS ((int)); -static long nlmlex_get_number PARAMS ((const char *)); -static void nlmheader_identify PARAMS ((void)); -static void nlmheader_warn PARAMS ((const char *, int)); -static void nlmheader_error PARAMS ((const char *)); -static struct string_list * string_list_cons PARAMS ((char *, - struct string_list *)); -static struct string_list * string_list_append PARAMS ((struct string_list *, - struct string_list *)); -static struct string_list * string_list_append1 PARAMS ((struct string_list *, - char *)); -static char *xstrdup PARAMS ((const char *)); +static int yylex (void); +static void nlmlex_file_push (const char *); +static bfd_boolean nlmlex_file_open (const char *); +static int nlmlex_buf_init (void); +static char nlmlex_buf_add (int); +static long nlmlex_get_number (const char *); +static void nlmheader_identify (void); +static void nlmheader_warn (const char *, int); +static void nlmheader_error (const char *); +static struct string_list * string_list_cons (char *, struct string_list *); +static struct string_list * string_list_append (struct string_list *, + struct string_list *); +static struct string_list * string_list_append1 (struct string_list *, + char *); +static char *xstrdup (const char *); %} @@ -117,7 +116,7 @@ static char *xstrdup PARAMS ((const char *)); /* The reserved words. */ -%token CHECK CODESTART COPYRIGHT CUSTOM DATE DEBUG DESCRIPTION EXIT +%token CHECK CODESTART COPYRIGHT CUSTOM DATE DEBUG_K DESCRIPTION EXIT %token EXPORT FLAG_ON FLAG_OFF FULLMAP HELP IMPORT INPUT MAP MESSAGES %token MODULE MULTIPLE OS_DOMAIN OUTPUT PSEUDOPREEMPTION REENTRANT %token SCREENNAME SHARELIB STACK START SYNCHRONIZE @@ -140,7 +139,7 @@ static char *xstrdup PARAMS ((const char *)); /* The entire file is just a list of commands. */ -file: +file: commands ; @@ -202,9 +201,9 @@ command: if (version_hdr->year < 1900 || version_hdr->year > 3000) nlmheader_warn (_("illegal year"), -1); } - | DEBUG + | DEBUG_K { - debug_info = true; + debug_info = TRUE; } | DESCRIPTION QUOTED_STRING { @@ -247,12 +246,12 @@ command: | FULLMAP { map_file = ""; - full_map = true; + full_map = TRUE; } | FULLMAP STRING { map_file = $2; - full_map = true; + full_map = TRUE; } | HELP STRING { @@ -365,7 +364,7 @@ command: } | VERBOSE { - verbose = true; + verbose = TRUE; } | VERSIONK STRING STRING STRING { @@ -494,7 +493,7 @@ string_list: /* If strerror is just a macro, we want to use the one from libiberty since it will handle undefined values. */ #undef strerror -extern char *strerror (); +extern char *strerror (int); /* The lexer is simple, too simple for flex. Keywords are only recognized at the start of lines. Everything else must be an @@ -535,9 +534,8 @@ static struct input current; /* Start the lexer going on the main input file. */ -boolean -nlmlex_file (name) - const char *name; +bfd_boolean +nlmlex_file (const char *name) { current.next = NULL; return nlmlex_file_open (name); @@ -546,8 +544,7 @@ nlmlex_file (name) /* Start the lexer going on a subsidiary input file. */ static void -nlmlex_file_push (name) - const char *name; +nlmlex_file_push (const char *name) { struct input *push; @@ -564,21 +561,20 @@ nlmlex_file_push (name) /* Start lexing from a file. */ -static boolean -nlmlex_file_open (name) - const char *name; +static bfd_boolean +nlmlex_file_open (const char *name) { current.file = fopen (name, "r"); if (current.file == NULL) { fprintf (stderr, "%s:%s: %s\n", program_name, name, strerror (errno)); ++parse_errors; - return false; + return FALSE; } current.name = xstrdup (name); current.lineno = 1; current.state = BEGINNING_OF_LINE; - return true; + return TRUE; } /* Table used to turn keywords into tokens. */ @@ -589,14 +585,14 @@ struct keyword_tokens_struct int token; }; -struct keyword_tokens_struct keyword_tokens[] = +static struct keyword_tokens_struct keyword_tokens[] = { { "CHECK", CHECK }, { "CODESTART", CODESTART }, { "COPYRIGHT", COPYRIGHT }, { "CUSTOM", CUSTOM }, { "DATE", DATE }, - { "DEBUG", DEBUG }, + { "DEBUG", DEBUG_K }, { "DESCRIPTION", DESCRIPTION }, { "EXIT", EXIT }, { "EXPORT", EXPORT }, @@ -639,7 +635,7 @@ static int lex_pos; ((void) (lex_buf != NULL ? lex_pos = 0 : nlmlex_buf_init ())) static int -nlmlex_buf_init () +nlmlex_buf_init (void) { lex_size = 10; lex_buf = xmalloc (lex_size + 1); @@ -657,8 +653,7 @@ nlmlex_buf_init () : nlmlex_buf_add (c))) static char -nlmlex_buf_add (c) - int c; +nlmlex_buf_add (int c) { if (lex_pos >= lex_size) { @@ -673,7 +668,7 @@ nlmlex_buf_add (c) code. */ static int -yylex () +yylex (void) { int c; @@ -745,7 +740,7 @@ tail_recurse: BUF_FINISH (); ungetc (c, current.file); - + nlmlex_file_push (lex_buf); goto tail_recurse; } @@ -784,7 +779,7 @@ tail_recurse: return keyword_tokens[i].token; } } - + nlmheader_identify (); fprintf (stderr, _("%s:%d: unrecognized keyword: %s\n"), current.name, current.lineno, lex_buf); @@ -856,8 +851,7 @@ tail_recurse: /* Get a number from a string. */ static long -nlmlex_get_number (s) - const char *s; +nlmlex_get_number (const char *s) { long ret; char *send; @@ -874,7 +868,7 @@ nlmlex_get_number (s) number. */ static void -nlmheader_identify () +nlmheader_identify (void) { static int done; @@ -889,9 +883,7 @@ nlmheader_identify () /* Issue a warning. */ static void -nlmheader_warn (s, imax) - const char *s; - int imax; +nlmheader_warn (const char *s, int imax) { nlmheader_identify (); fprintf (stderr, "%s:%d: %s", current.name, current.lineno, s); @@ -903,8 +895,7 @@ nlmheader_warn (s, imax) /* Report an error. */ static void -nlmheader_error (s) - const char *s; +nlmheader_error (const char *s) { nlmheader_warn (s, -1); ++parse_errors; @@ -913,9 +904,7 @@ nlmheader_error (s) /* Add a string to a string list. */ static struct string_list * -string_list_cons (s, l) - char *s; - struct string_list *l; +string_list_cons (char *s, struct string_list *l) { struct string_list *ret; @@ -928,9 +917,7 @@ string_list_cons (s, l) /* Append a string list to another string list. */ static struct string_list * -string_list_append (l1, l2) - struct string_list *l1; - struct string_list *l2; +string_list_append (struct string_list *l1, struct string_list *l2) { register struct string_list **pp; @@ -943,9 +930,7 @@ string_list_append (l1, l2) /* Append a string to a string list. */ static struct string_list * -string_list_append1 (l, s) - struct string_list *l; - char *s; +string_list_append1 (struct string_list *l, char *s) { struct string_list *n; register struct string_list **pp; @@ -962,8 +947,7 @@ string_list_append1 (l, s) /* Duplicate a string in memory. */ static char * -xstrdup (s) - const char *s; +xstrdup (const char *s) { unsigned long len; char *ret;