From 83bcb37903a025de78f588e13081a2af9406c835 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Thu, 17 Jun 2010 13:55:35 +0000 Subject: [PATCH] PR binutils/11711 * windres.c (enum option_values): New enum. (long_options): Use separate option number for --include-dir option. (main): Separate backwards compatibility check from code to implement --include-dir. Check to see if directory exists and do not complain if it does. --- binutils/ChangeLog | 10 ++++++++++ binutils/windres.c | 41 ++++++++++++++++++++++++++++++----------- 2 files changed, 40 insertions(+), 11 deletions(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 0908d6a895e..9fb722c2eb5 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,13 @@ +2010-06-17 Nick Clifton + + PR binutils/11711 + * windres.c (enum option_values): New enum. + (long_options): Use separate option number for --include-dir + option. + (main): Separate backwards compatibility check from code to + implement --include-dir. Check to see if directory exists and do + not complain if it does. + 2010-06-15 Joseph Myers * readelf.c (display_tic6x_attribute, process_tic6x_specific): diff --git a/binutils/windres.c b/binutils/windres.c index acc65f758fc..05b7559f744 100644 --- a/binutils/windres.c +++ b/binutils/windres.c @@ -45,6 +45,7 @@ #include "safe-ctype.h" #include "obstack.h" #include "windres.h" +#include /* Used by resrc.c at least. */ @@ -726,12 +727,15 @@ quot (const char *string) /* Long options. */ -/* 150 isn't special; it's just an arbitrary non-ASCII char value. */ - -#define OPTION_PREPROCESSOR 150 -#define OPTION_USE_TEMP_FILE (OPTION_PREPROCESSOR + 1) -#define OPTION_NO_USE_TEMP_FILE (OPTION_USE_TEMP_FILE + 1) -#define OPTION_YYDEBUG (OPTION_NO_USE_TEMP_FILE + 1) +enum option_values +{ + /* 150 isn't special; it's just an arbitrary non-ASCII char value. */ + OPTION_PREPROCESSOR = 150, + OPTION_USE_TEMP_FILE, + OPTION_NO_USE_TEMP_FILE, + OPTION_YYDEBUG, + OPTION_INCLUDE_DIR +}; static const struct option long_options[] = { @@ -741,7 +745,7 @@ static const struct option long_options[] = {"output-format", required_argument, 0, 'O'}, {"target", required_argument, 0, 'F'}, {"preprocessor", required_argument, 0, OPTION_PREPROCESSOR}, - {"include-dir", required_argument, 0, 'I'}, + {"include-dir", required_argument, 0, OPTION_INCLUDE_DIR}, {"define", required_argument, 0, 'D'}, {"undefine", required_argument, 0, 'U'}, {"verbose", no_argument, 0, 'v'}, @@ -918,12 +922,27 @@ main (int argc, char **argv) input_format_tmp = format_from_name (optarg, 0); if (input_format_tmp != RES_FORMAT_UNKNOWN) { - fprintf (stderr, - _("Option -I is deprecated for setting the input format, please use -J instead.\n")); - input_format = input_format_tmp; - break; + struct stat statbuf; + char modebuf[11]; + + if (stat (optarg, & statbuf) == 0 + /* Coded this way to avoid importing knowledge of S_ISDIR into this file. */ + && (mode_string (statbuf.st_mode, modebuf), modebuf[0] == 'd')) + /* We have a -I option with a directory name that just happens + to match a format name as well. eg: -I res Assume that the + user knows what they are doing and do not complain. */ + ; + else + { + fprintf (stderr, + _("Option -I is deprecated for setting the input format, please use -J instead.\n")); + input_format = input_format_tmp; + break; + } } + /* Fall through. */ + case OPTION_INCLUDE_DIR: if (preprocargs == NULL) { quotedarg = quot (optarg); -- 2.30.2