diff options
author | Jakub Jelinek <jakub@redhat.com> | 2017-01-16 22:33:07 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2017-01-16 22:33:07 +0100 |
commit | 1c70261c9a4d7faedfb03a79753b9acf81195561 (patch) | |
tree | 42e4ab59078ab992f7c8dd3456b96869aaa874b8 /gcc/gcc.c | |
parent | a60c3351032bbaad8c45dbad341437ba47540568 (diff) | |
download | gcc-1c70261c9a4d7faedfb03a79753b9acf81195561.zip gcc-1c70261c9a4d7faedfb03a79753b9acf81195561.tar.gz gcc-1c70261c9a4d7faedfb03a79753b9acf81195561.tar.bz2 |
re PR driver/49726 (-g0 file.S -g does not produce debug info)
PR driver/49726
* gcc.c (debug_level_greater_than_spec_func): New function.
(static_spec_functions): Add debug-level-gt spec function.
(ASM_DEBUG_SPEC, cpp_options): Use %:debug-level-gt(0) instead of
!g0.
* config/darwin.h (DSYMUTIL_SPEC, ASM_DEBUG_SPEC): Likewise.
* config/darwin9.h (DSYMUTIL_SPEC, ASM_DEBUG_SPEC): Likewise.
* common.opt (g, gcoff, gdwarf, gdwarf-, ggdb, gno-pubnames,
gpubnames, ggnu-pubnames, gno-record-gcc-switches,
grecord-gcc-switches, gno-strict-dwarf, gstrict-dwarf, gstabs,
gstabs+, gtoggle, gvms, gxcoff, gxcoff+): Add Driver flag.
c-family/
* c.opt (gen-decls): Add Driver flag.
ada/
* gcc-interface/lang.opt (gant, gnatO, gnat): Add Driver flag.
From-SVN: r244505
Diffstat (limited to 'gcc/gcc.c')
-rw-r--r-- | gcc/gcc.c | 36 |
1 files changed, 31 insertions, 5 deletions
@@ -402,6 +402,7 @@ static const char *compare_debug_auxbase_opt_spec_function (int, const char **); static const char *pass_through_libs_spec_func (int, const char **); static const char *replace_extension_spec_func (int, const char **); static const char *greater_than_spec_func (int, const char **); +static const char *debug_level_greater_than_spec_func (int, const char **); static char *convert_white_space (char *); /* The Specs Language @@ -833,14 +834,16 @@ proper position among the other output files. */ && defined(HAVE_AS_GDWARF2_DEBUG_FLAG) && defined(HAVE_AS_GSTABS_DEBUG_FLAG) # define ASM_DEBUG_SPEC \ (PREFERRED_DEBUGGING_TYPE == DBX_DEBUG \ - ? "%{!g0:%{gdwarf*:--gdwarf2}%{!gdwarf*:%{g*:--gstabs}}}" ASM_MAP \ - : "%{!g0:%{gstabs*:--gstabs}%{!gstabs*:%{g*:--gdwarf2}}}" ASM_MAP) + ? "%{%:debug-level-gt(0):" \ + "%{gdwarf*:--gdwarf2}%{!gdwarf*:%{g*:--gstabs}}}" ASM_MAP \ + : "%{%:debug-level-gt(0):" \ + "%{gstabs*:--gstabs}%{!gstabs*:%{g*:--gdwarf2}}}" ASM_MAP) # else # if defined(DBX_DEBUGGING_INFO) && defined(HAVE_AS_GSTABS_DEBUG_FLAG) -# define ASM_DEBUG_SPEC "%{g*:%{!g0:--gstabs}}" ASM_MAP +# define ASM_DEBUG_SPEC "%{g*:%{%:debug-level-gt(0):--gstabs}}" ASM_MAP # endif # if defined(DWARF2_DEBUGGING_INFO) && defined(HAVE_AS_GDWARF2_DEBUG_FLAG) -# define ASM_DEBUG_SPEC "%{g*:%{!g0:--gdwarf2}}" ASM_MAP +# define ASM_DEBUG_SPEC "%{g*:%{%:debug-level-gt(0):--gdwarf2}}" ASM_MAP # endif # endif #endif @@ -1119,7 +1122,8 @@ static const char *cpp_unique_options = in turn cause preprocessor symbols to be defined specially. */ static const char *cpp_options = "%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\ - %{f*} %{g*:%{!g0:%{g*} %{!fno-working-directory:-fworking-directory}}} %{O*}\ + %{f*} %{g*:%{%:debug-level-gt(0):%{g*}\ + %{!fno-working-directory:-fworking-directory}}} %{O*}\ %{undef} %{save-temps*:-fpch-preprocess}"; /* This contains cpp options which are not passed when the preprocessor @@ -1639,6 +1643,7 @@ static const struct spec_function static_spec_functions[] = { "pass-through-libs", pass_through_libs_spec_func }, { "replace-extension", replace_extension_spec_func }, { "gt", greater_than_spec_func }, + { "debug-level-gt", debug_level_greater_than_spec_func }, #ifdef EXTRA_SPEC_FUNCTIONS EXTRA_SPEC_FUNCTIONS #endif @@ -9863,6 +9868,27 @@ greater_than_spec_func (int argc, const char **argv) return NULL; } +/* Returns "" if debug_info_level is greater than ARGV[ARGC-1]. + Otherwise, return NULL. */ + +static const char * +debug_level_greater_than_spec_func (int argc, const char **argv) +{ + char *converted; + + if (argc != 1) + fatal_error (input_location, + "wrong number of arguments to %%:debug-level-gt"); + + long arg = strtol (argv[0], &converted, 10); + gcc_assert (converted != argv[0]); + + if (debug_info_level > arg) + return ""; + + return NULL; +} + /* Insert backslash before spaces in ORIG (usually a file path), to avoid being broken by spec parser. |