From: law Date: Mon, 17 May 1999 23:37:19 +0000 (+0000) Subject: * cppspec.c: Insert -no-gcc into command line unless -gcc was X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e46f56735efc7e6083f08782e79738fdc52ca0ed;p=platform%2Fupstream%2Flinaro-gcc.git * cppspec.c: Insert -no-gcc into command line unless -gcc was given by user. * gcc.c (default_compilers): Define __GNUC__ and __GNUC_MINOR__ only if -no-gcc was not given. * objc/lang-specs.h: Likewise. * cpp.texi: Document -x and -std options; explain that -lang is no longer supported. Minor related corrections. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@26990 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1308fab..fc5dd1a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +Tue May 18 00:21:34 1999 Zack Weinberg + + * cppspec.c: Insert -no-gcc into command line unless -gcc was + given by user. + * gcc.c (default_compilers): Define __GNUC__ and + __GNUC_MINOR__ only if -no-gcc was not given. + * objc/lang-specs.h: Likewise. + * cpp.texi: Document -x and -std options; explain that -lang + is no longer supported. Minor related corrections. + Mon May 17 23:56:39 1999 Alexandre Oliva * Makefile.in (stmp-fixproto): Pass location of mkinstalldirs to diff --git a/gcc/cpp.texi b/gcc/cpp.texi index 7552cf9..ca50137 100644 --- a/gcc/cpp.texi +++ b/gcc/cpp.texi @@ -2658,7 +2658,9 @@ warnings. @item -Wtrigraphs @findex -Wtrigraphs -Warn if any trigraphs are encountered (assuming they are enabled). +Warn if any trigraphs are encountered. Currently this only works if you +have turned trigraphs on with @samp{-trigraphs} or @samp{-ansi}; in the +future this restriction will be removed. @item -Wcomment @findex -Wcomment @@ -2756,6 +2758,12 @@ is not predefined. @findex -undef Do not predefine any nonstandard macros. +@item -gcc +@findex -gcc +Define the macros @var{__GNUC__} and @var{__GNUC_MINOR__}. These are +defined automatically when you use @samp{gcc -E}; you can turn them off +in that case with @samp{-no-gcc}. + @item -A @var{predicate}(@var{answer}) @findex -A Make an assertion with the predicate @var{predicate} and answer @@ -2763,7 +2771,8 @@ Make an assertion with the predicate @var{predicate} and answer @noindent You can use @samp{-A-} to disable all predefined assertions; it also -undefines all predefined macros that identify the type of target system. +undefines all predefined macros and all macros that preceded it on the +command line. @item -dM @findex -dM @@ -2874,48 +2883,75 @@ Add a directory to the beginning of the second include path, marking it as a system directory, so that it gets the same special treatment as is applied to the standard system directories. -@item -lang-c -@itemx -lang-c89 -@itemx -lang-c++ -@itemx -lang-objc -@itemx -lang-objc++ -@findex -lang-c -@findex -lang-c89 -@findex -lang-c++ -@findex -lang-objc -@findex -lang-objc++ -Specify the source language. @samp{-lang-c} is the default; it -allows recognition of C++ comments (comments that begin with -@samp{//} and end at end of line) and hexadecimal floating-point constants, -since these features will most likely appear in the next C standard. -@samp{-lang-c89} disables recognition of C++ comments and -hexadecimal floating-point constants. @samp{-lang-c++} -handles C++ comment syntax and includes extra default include -directories for C++. @samp{-lang-objc} enables the Objective C -@samp{#import} directive. @samp{-lang-objc++} enables both C++ and Objective C -extensions. - -These options are generated by the compiler driver @code{gcc}, but not -passed from the @samp{gcc} command line unless you use the driver's -@samp{-Wp} option. - -@item -lint +@item -x c +@itemx -x c++ +@itemx -x objective-c +@itemx -x assembler-with-cpp +@findex -x c +@findex -x objective-c +@findex -x assembler-with-cpp +Specify the source language: C, C++, Objective-C, or assembly. This has +nothing to do with standards conformance or extensions; it merely +selects which base syntax to expect. If you give none of these options, +cpp will deduce the language from the extension of the source file: +@samp{.c}, @samp{.cc}, @samp{.m}, or @samp{.S}. Some other common +extensions for C++ and assembly are also recognized. If cpp does not +recognize the extension, it will treat the file as C; this is the most +generic mode. + +@strong{Note:} Previous versions of cpp accepted a @samp{-lang} option +which selected both the language and the standards conformance level. +This option has been removed, because it conflicts with the @samp{-l} +option. + +@item -std=@var{standard} +@itemx -ansi +@findex -std +@findex -ansi +Specify the standard to which the code should conform. Currently cpp +only knows about the standards for C; other language standards will be +added in the future. + +@var{standard} +may be one of: +@table @code +@item iso9899:1990 +The ISO C standard from 1990. + +@item iso9899:199409 +@itemx c89 +The 1990 C standard, as amended in 1994. @samp{c89} is the customary +shorthand for this version of the standard. + +The @samp{-ansi} option is equivalent to @samp{-std=c89}. + +@item iso9899:199x +@itemx c9x +The revised ISO C standard, which is expected to be promulgated some +time in 1999. It has not been approved yet, hence the @samp{x}. + +@item gnu89 +The 1990 C standard plus GNU extensions. This is the default. + +@item gnu9x +The 199x C standard plus GNU extensions. +@end table + +@item -Wp,-lint +@findex -lint Look for commands to the program checker @code{lint} embedded in comments, and emit them preceded by @samp{#pragma lint}. For example, the comment @samp{/* NOTREACHED */} becomes @samp{#pragma lint NOTREACHED}. -This option is available only when you call @code{cpp} directly; -@code{gcc} will not pass it from its command line. +Because of the clash with @samp{-l}, you must use the awkward syntax +above. In a future release, this option will be replaced by +@samp{-flint} or @samp{-Wlint}; we are not sure which yet. @item -$ @findex -$ -Forbid the use of @samp{$} in identifiers. This was formerly required -for strict conformance to the C Standard before the standard was -corrected. - -This option is available only when you call @code{cpp} directly; -@code{gcc} will not pass it from its command line. +Forbid the use of @samp{$} in identifiers. The C standard does not +permit this, but it is a common extension. @end table diff --git a/gcc/cppspec.c b/gcc/cppspec.c index 2908b73..2e02216 100644 --- a/gcc/cppspec.c +++ b/gcc/cppspec.c @@ -84,6 +84,9 @@ lang_specific_driver (errfn, in_argc, in_argv, in_added_libraries) /* Do we need to insert -E? */ int need_E = 1; + /* Do we need to insert -no-gcc? */ + int need_no_gcc = 1; + /* Have we seen an input file? */ int seen_input = 0; @@ -135,6 +138,8 @@ lang_specific_driver (errfn, in_argc, in_argv, in_added_libraries) } else if (argv[i][1] == 'x') need_fixups = 0; + else if (argv[i][1] == 'g' && !strcmp(&argv[i][2], "cc")) + need_no_gcc = 0; else if (WORD_SWITCH_TAKES_ARG (&argv[i][1])) quote = 1; } @@ -183,7 +188,7 @@ lang_specific_driver (errfn, in_argc, in_argv, in_added_libraries) /* If we don't need to edit the command line, we can bail early. */ - new_argc = argc + need_E + read_stdin + new_argc = argc + need_E + need_no_gcc + read_stdin + !!o_here + !!lang_c_here + !!lang_S_here; if (new_argc == argc) @@ -197,6 +202,9 @@ lang_specific_driver (errfn, in_argc, in_argv, in_added_libraries) if (need_E) new_argv[j++] = "-E"; + if (need_no_gcc) + new_argv[j++] = "-no-gcc"; + for (i = 1; i < argc; i++, j++) { if (i == lang_c_here) diff --git a/gcc/gcc.c b/gcc/gcc.c index 9e2573d..e02bc0c 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -598,7 +598,7 @@ static struct compiler default_compilers[] = %{C} %{v} %{A*} %{I*} %{P} %{$} %I\ %{C:%{!E:%eGNU C does not support -C without using -E}}\ %{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\ - -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\ + %{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2}\ %{ansi|std=*:%{!std=gnu*:-trigraphs -D__STRICT_ANSI__}}\ %{!undef:%{!ansi:%{!std=*:%p}%{std=gnu*:%p}} %P} %{trigraphs}\ %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\ @@ -612,7 +612,7 @@ static struct compiler default_compilers[] = %{std*} %{nostdinc*} %{A*} %{I*} %I\ %{!Q:-quiet} -dumpbase %b.c %{d*} %{m*} %{a*}\ %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\ - -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\ + %{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2}\ %{ansi|std=*:%{!std=gnu*:-trigraphs -D__STRICT_ANSI__}}\ %{!undef:%{!ansi:%{!std=*:%p}%{std=gnu*:%p}} %P} %{trigraphs}\ %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\ @@ -634,7 +634,7 @@ static struct compiler default_compilers[] = %{C} %{v} %{A*} %{I*} %{P} %{$} %I\ %{C:%{!E:%eGNU C does not support -C without using -E}}\ %{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\ - -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\ + %{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2}\ %{ansi|std=*:%{!std=gnu*:-trigraphs -D__STRICT_ANSI__}}\ %{!undef:%{!ansi:%{!std=*:%p}%{std=gnu*:%p}} %P} %{trigraphs}\ %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\ @@ -662,7 +662,7 @@ static struct compiler default_compilers[] = %{C} %{v} %{A*} %{I*} %{P} %{$} %I\ %{C:%{!E:%eGNU C does not support -C without using -E}}\ %{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\ - -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\ + %{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2}\ %{ansi|std=*:%{!std=gnu*:-trigraphs -D__STRICT_ANSI__}}\ %{!undef:%{!ansi:%{!std=*:%p}%{std=gnu*:%p}} %P} %{trigraphs}\ %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\ @@ -679,7 +679,7 @@ static struct compiler default_compilers[] = cpp %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %{$} %I\ %{C:%{!E:%eGNU C does not support -C without using -E}}\ %{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\ - -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\ + %{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2}\ %{std=*:%{!std=gnu*:-trigraphs -D__STRICT_ANSI__}}\ %{!undef:%{!std=*:%p}%{std=gnu*:%p} %P} %{trigraphs}\ %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\ diff --git a/gcc/objc/lang-specs.h b/gcc/objc/lang-specs.h index d76dee8..41dc097 100644 --- a/gcc/objc/lang-specs.h +++ b/gcc/objc/lang-specs.h @@ -27,7 +27,7 @@ Boston, MA 02111-1307, USA. */ {"%{E|M|MM:cpp -lang-objc %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %{$} %I\ %{C:%{!E:%eGNU C does not support -C without using -E}}\ %{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\ - -D__OBJC__ -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\ + -D__OBJC__ %{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2}\ %{ansi:-trigraphs -D__STRICT_ANSI__}\ %{!undef:%{!ansi:%p} %P} %{trigraphs}\ %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\ @@ -40,7 +40,7 @@ Boston, MA 02111-1307, USA. */ "%{!M:%{!MM:%{!E:cc1obj %i %1 \ %{nostdinc*} %{A*} %{I*} %{P} %I\ %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\ - -D__OBJC__ -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\ + -D__OBJC__ %{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2}\ %{!undef:%{!ansi:%p} %P} %{trigraphs}\ %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\ %{ffast-math:-D__FAST_MATH__}\ @@ -58,7 +58,7 @@ Boston, MA 02111-1307, USA. */ {"cpp -lang-objc %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %{$} %I\ %{C:%{!E:%eGNU C does not support -C without using -E}}\ %{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\ - -D__OBJC__ -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\ + -D__OBJC__ %{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2}\ %{ansi:-trigraphs -D__STRICT_ANSI__}\ %{!undef:%{!ansi:%p} %P} %{trigraphs}\ %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\