aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog10
-rw-r--r--binutils/windres.c41
2 files changed, 40 insertions, 11 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 0908d6a..9fb722c 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,13 @@
+2010-06-17 Nick Clifton <nickc@redhat.com>
+
+ 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 <joseph@codesourcery.com>
* readelf.c (display_tic6x_attribute, process_tic6x_specific):
diff --git a/binutils/windres.c b/binutils/windres.c
index acc65f7..05b7559 100644
--- a/binutils/windres.c
+++ b/binutils/windres.c
@@ -45,6 +45,7 @@
#include "safe-ctype.h"
#include "obstack.h"
#include "windres.h"
+#include <sys/stat.h>
/* 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);