aboutsummaryrefslogtreecommitdiff
path: root/gcc/opts.h
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2010-06-12 01:12:12 +0100
committerJoseph Myers <jsm28@gcc.gnu.org>2010-06-12 01:12:12 +0100
commit5d4b393fec167eb77a327b4972ffba672425ea43 (patch)
tree50451f0ea94bd6c134f87ada11def37b34fdd724 /gcc/opts.h
parentb79a08f6c4b57f701b6a879365b5506003cefba7 (diff)
downloadgcc-5d4b393fec167eb77a327b4972ffba672425ea43.zip
gcc-5d4b393fec167eb77a327b4972ffba672425ea43.tar.gz
gcc-5d4b393fec167eb77a327b4972ffba672425ea43.tar.bz2
opts-common.c: Include options.h.
* opts-common.c: Include options.h. (integral_argument): Move from opts.c. (decode_cmdline_option): New. Based on read_cmdline_option. * opts.c (integral_argument): Move to opts-common.c. (read_cmdline_option): Move most contents to decode_cmdline_option. Use %qs in diagnostics. * opts.h (CL_ERR_DISABLED, CL_ERR_MISSING_ARG, CL_ERR_WRONG_LANG, CL_ERR_UINT_ARG, struct cl_decoded_option, integral_argument, decode_cmdline_option): New. testsuite: * gcc.dg/funroll-loops-all.c: Update expected error. From-SVN: r160639
Diffstat (limited to 'gcc/opts.h')
-rw-r--r--gcc/opts.h34
1 files changed, 33 insertions, 1 deletions
diff --git a/gcc/opts.h b/gcc/opts.h
index af3c6e2..c50cbca 100644
--- a/gcc/opts.h
+++ b/gcc/opts.h
@@ -1,5 +1,5 @@
/* Command line option handling.
- Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008
+ Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
This file is part of GCC.
@@ -90,6 +90,34 @@ extern const unsigned int cl_lang_count;
#define CL_UINTEGER (1 << 29) /* Argument is an integer >=0. */
#define CL_UNDOCUMENTED (1 << 30) /* Do not output with --help. */
+/* Possible ways in which a command-line option may be erroneous.
+ These do not include not being known at all; an option index of
+ cl_options_count is used for that. */
+
+#define CL_ERR_DISABLED (1 << 0) /* Disabled in this configuration. */
+#define CL_ERR_MISSING_ARG (1 << 1) /* Argument required but missing. */
+#define CL_ERR_WRONG_LANG (1 << 2) /* Option for wrong language. */
+#define CL_ERR_UINT_ARG (1 << 3) /* Bad unsigned integer argument. */
+
+/* Structure describing the result of decoding an option. */
+
+struct cl_decoded_option
+{
+ /* The index of this option, or cl_options_count if not known. */
+ size_t opt_index;
+
+ /* The string argument, or NULL if none. */
+ const char *arg;
+
+ /* For a boolean option, 1 for the true case and 0 for the "no-"
+ case. For an unsigned integer option, the value of the
+ argument. 1 in all other cases. */
+ int value;
+
+ /* Any flags describing errors detected in this option. */
+ int errors;
+};
+
/* Input file names. */
extern const char **in_fnames;
@@ -99,6 +127,10 @@ extern const char **in_fnames;
extern unsigned num_in_fnames;
size_t find_opt (const char *input, int lang_mask);
+extern int integral_argument (const char *arg);
+extern unsigned int decode_cmdline_option (const char **argv,
+ unsigned int lang_mask,
+ struct cl_decoded_option *decoded);
extern void prune_options (int *argcp, char ***argvp);
extern void decode_options (unsigned int argc, const char **argv);
extern int option_enabled (int opt_idx);