1132718Skan/* Command line option handling. 2169689Skan Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. 3132718Skan 4132718SkanThis file is part of GCC. 5132718Skan 6132718SkanGCC is free software; you can redistribute it and/or modify it under 7132718Skanthe terms of the GNU General Public License as published by the Free 8132718SkanSoftware Foundation; either version 2, or (at your option) any later 9132718Skanversion. 10132718Skan 11132718SkanGCC is distributed in the hope that it will be useful, but WITHOUT ANY 12132718SkanWARRANTY; without even the implied warranty of MERCHANTABILITY or 13132718SkanFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14132718Skanfor more details. 15132718Skan 16132718SkanYou should have received a copy of the GNU General Public License 17132718Skanalong with GCC; see the file COPYING. If not, write to the Free 18169689SkanSoftware Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 19169689Skan02110-1301, USA. */ 20132718Skan 21132718Skan#ifndef GCC_OPTS_H 22132718Skan#define GCC_OPTS_H 23132718Skan 24169689Skan/* Specifies how a switch's VAR_VALUE relates to its FLAG_VAR. */ 25169689Skanenum cl_var_type { 26169689Skan /* The switch is enabled when FLAG_VAR is nonzero. */ 27169689Skan CLVC_BOOLEAN, 28132718Skan 29169689Skan /* The switch is enabled when FLAG_VAR == VAR_VALUE. */ 30169689Skan CLVC_EQUAL, 31169689Skan 32169689Skan /* The switch is enabled when VAR_VALUE is not set in FLAG_VAR. */ 33169689Skan CLVC_BIT_CLEAR, 34169689Skan 35169689Skan /* The switch is enabled when VAR_VALUE is set in FLAG_VAR. */ 36169689Skan CLVC_BIT_SET, 37169689Skan 38169689Skan /* The switch takes a string argument and FLAG_VAR points to that 39169689Skan argument. */ 40169689Skan CLVC_STRING 41169689Skan}; 42169689Skan 43132718Skanstruct cl_option 44132718Skan{ 45132718Skan const char *opt_text; 46132718Skan const char *help; 47132718Skan unsigned short back_chain; 48132718Skan unsigned char opt_len; 49169689Skan int neg_index; 50132718Skan unsigned int flags; 51169689Skan void *flag_var; 52169689Skan enum cl_var_type var_type; 53169689Skan int var_value; 54132718Skan}; 55132718Skan 56169689Skan/* Records that the state of an option consists of SIZE bytes starting 57169689Skan at DATA. DATA might point to CH in some cases. */ 58169689Skanstruct cl_option_state { 59169689Skan const void *data; 60169689Skan size_t size; 61169689Skan char ch; 62169689Skan}; 63169689Skan 64132718Skanextern const struct cl_option cl_options[]; 65132718Skanextern const unsigned int cl_options_count; 66132718Skanextern const char *const lang_names[]; 67169689Skanextern bool no_unit_at_a_time_default; 68132718Skan 69169689Skan#define CL_DISABLED (1 << 21) /* Disabled in this configuration. */ 70169689Skan#define CL_TARGET (1 << 22) /* Target-specific option. */ 71169689Skan#define CL_REPORT (1 << 23) /* Report argument with -fverbose-asm */ 72132718Skan#define CL_JOINED (1 << 24) /* If takes joined argument. */ 73132718Skan#define CL_SEPARATE (1 << 25) /* If takes a separate argument. */ 74132718Skan#define CL_REJECT_NEGATIVE (1 << 26) /* Reject no- form. */ 75132718Skan#define CL_MISSING_OK (1 << 27) /* Missing argument OK (joined). */ 76132718Skan#define CL_UINTEGER (1 << 28) /* Argument is an integer >=0. */ 77132718Skan#define CL_COMMON (1 << 29) /* Language-independent. */ 78132718Skan#define CL_UNDOCUMENTED (1 << 30) /* Do not output with --help. */ 79132718Skan 80132718Skan/* Input file names. */ 81132718Skan 82132718Skanextern const char **in_fnames; 83132718Skan 84132718Skan/* The count of input filenames. */ 85132718Skan 86132718Skanextern unsigned num_in_fnames; 87132718Skan 88169689Skansize_t find_opt (const char *input, int lang_mask); 89169689Skanextern void prune_options (int *argcp, char ***argvp); 90169689Skanextern void decode_options (unsigned int argc, const char **argv); 91169689Skanextern int option_enabled (int opt_idx); 92169689Skanextern bool get_option_state (int, struct cl_option_state *); 93169689Skan 94132718Skan#endif 95