warning_with_decl (olddecl, "non-prototype definition here");
}
}
- /* Warn if function is now inline
- but was previously declared not inline and has been called. */
+ /* Warn about mismatches in various flags. */
else
{
+ /* Warn if function is now inline
+ but was previously declared not inline and has been called. */
if (TREE_CODE (olddecl) == FUNCTION_DECL
&& ! TREE_INLINE (olddecl) && TREE_INLINE (newdecl)
&& TREE_USED (olddecl))
&& !TREE_PUBLIC (newdecl))
warning_with_decl (newdecl, "static declaration for `%s' follows non-static");
- /* These bits are logically part of the type. */
- if (pedantic
+ /* These bits are logically part of the type, for variables.
+ But not for functions
+ (where qualifiers are not valid ANSI anyway). */
+ if (pedantic && TREE_CODE (olddecl) != FUNCTION_DECL
&& (TREE_READONLY (newdecl) != TREE_READONLY (olddecl)
|| TREE_THIS_VOLATILE (newdecl) != TREE_THIS_VOLATILE (olddecl)))
pedwarn_with_decl (newdecl, "type qualifiers for `%s' conflict with previous decl");
DECL_ARG_TYPE (decl) = type;
if (type == float_type_node)
DECL_ARG_TYPE (decl) = double_type_node;
- else if (TREE_CODE (type) == INTEGER_TYPE
- && TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node))
- DECL_ARG_TYPE (decl) = integer_type_node;
+ /* Don't use TYPE_PREISION to decide whether to promote,
+ because we should convert short if it's the same size as int,
+ but we should not convert long if it's the same size as int. */
+ else if (type == char_type_node || type == signed_char_type_node
+ || type == unsigned_char_type_node
+ || type == short_integer_type_node
+ || type == short_unsigned_type_node)
+ {
+ if (TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node)
+ && TREE_UNSIGNED (type))
+ DECL_ARG_TYPE (decl) = unsigned_type_node;
+ else
+ DECL_ARG_TYPE (decl) = integer_type_node;
+ }
DECL_ARG_TYPE_AS_WRITTEN (decl) = type_as_written;
}
%P like %p, but puts `__' before and after the name of each macro.
(Except macros that already have __.)
This is for ANSI C.
+ %I Substitute a -iprefix option made from GCC_EXEC_PREFIX.
%s current argument is the name of a library or startup file of some sort.
Search for that file in a standard list of directories
and substitute the full name found.
{
{".c", "@c"},
{"@c",
- "cpp -lang-c %{nostdinc*} %{C} %{v} %{A*} %{D*} %{U*} %{I*} %{i*} %{P}\
+ "cpp -lang-c %{nostdinc*} %{C} %{v} %{A*} %{D*} %{U*} %{I*} %{i*} %{P} %I\
%{C:%{!E:%eGNU C does not support -C without using -E}}\
%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d}\
-undef -D__GNUC__=2 %{ansi:-trigraphs -$ -D__STRICT_ANSI__}\
%{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o}\
%{!pipe:%g.s} %A\n }}}}"},
{"-",
- "%{E:cpp -lang-c %{nostdinc*} %{C} %{v} %{A*} %{D*} %{U*} %{I*} %{i*} %{P}\
+ "%{E:cpp -lang-c %{nostdinc*} %{C} %{v} %{A*} %{D*} %{U*} %{I*} %{i*} %{P} %I\
%{C:%{!E:%eGNU C does not support -C without using -E}}\
%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d}\
-undef -D__GNUC__=2 %{ansi:-trigraphs -$ -D__STRICT_ANSI__}\
%{!E:%e-E required when input is from standard input}"},
{".m", "@objective-c"},
{"@objective-c",
- "cpp -lang-objc %{nostdinc*} %{C} %{v} %{A*} %{D*} %{U*} %{I*} %{i*} %{P}\
+ "cpp -lang-objc %{nostdinc*} %{C} %{v} %{A*} %{D*} %{U*} %{I*} %{i*} %{P} %I\
%{C:%{!E:%eGNU C does not support -C without using -E}}\
%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d}\
-undef -D__OBJC__ -D__GNUC__=2 %{ansi:-trigraphs -$ -D__STRICT_ANSI__}\
{".h", "@c-header"},
{"@c-header",
"%{!E:%eCompilation of header file requested} \
- cpp %{nostdinc*} %{C} %{v} %{A*} %{D*} %{U*} %{I*} %{i*} %{P}\
+ cpp %{nostdinc*} %{C} %{v} %{A*} %{D*} %{U*} %{I*} %{i*} %{P} %I\
%{C:%{!E:%eGNU C does not support -C without using -E}}\
%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} \
-undef -D__GNUC__=2 %{ansi:-trigraphs -$ -D__STRICT_ANSI__}\
{".cxx", "@c++"},
{".C", "@c++"},
{"@c++",
- "cpp -lang-c++ %{nostdinc*} %{C} %{v} %{A*} %{D*} %{U*} %{I*} %{i*} %{P}\
+ "cpp -lang-c++ %{nostdinc*} %{C} %{v} %{A*} %{D*} %{U*} %{I*} %{i*} %{P} %I\
%{C:%{!E:%eGNU C++ does not support -C without using -E}}\
%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} \
-undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus \
%{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o} %i %A\n }"},
{".S", "@assembler-with-cpp"},
{"@assembler-with-cpp",
- "cpp -lang-asm %{nostdinc*} %{C} %{v} %{A*} %{D*} %{U*} %{I*} %{i*} %{P}\
+ "cpp -lang-asm %{nostdinc*} %{C} %{v} %{A*} %{D*} %{U*} %{I*} %{i*} %{P} %I\
%{C:%{!E:%eGNU C does not support -C without using -E}}\
%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{trigraphs} \
-undef -$ %{!undef:%p %P} -D__ASSEMBLER__ \
static char *machine_suffix = 0;
+/* Adjusted value of GCC_EXEC_PREFIX envvar. */
+
+static char *gcc_exec_prefix;
+
/* Default prefixes to attach to command names. */
#ifdef CROSS_COMPILE /* Don't use these prefixes for a cross compiler. */
char *spec_lang = 0;
int last_language_n_infiles;
+ gcc_exec_prefix = getenv ("GCC_EXEC_PREFIX");
+
n_switches = 0;
n_infiles = 0;
spec_version = version_string;
/* Set up the default search paths. */
- temp = getenv ("GCC_EXEC_PREFIX");
- if (temp)
+ if (gcc_exec_prefix)
{
- add_prefix (&exec_prefix, temp, 0, 0, 0);
- add_prefix (&startfile_prefix, temp, 0, 0, 0);
+ add_prefix (&exec_prefix, gcc_exec_prefix, 0, 0, 0);
+ add_prefix (&startfile_prefix, gcc_exec_prefix, 0, 0, 0);
}
/* COMPILER_PATH and LIBRARY_PATH have values
if (!strcmp (p, "save-temps"))
{
save_temps_flag = 1;
+ n_switches++;
break;
}
default:
switches[n_switches].part1 = 0;
infiles[n_infiles].name = 0;
+
+ /* If we have a GCC_EXEC_PREFIX envvar, modify it for cpp's sake. */
+ if (gcc_exec_prefix)
+ {
+ temp = (char *) xmalloc (strlen (gcc_exec_prefix) + strlen (spec_version)
+ + strlen (spec_machine) + 3);
+ strcpy (temp, gcc_exec_prefix);
+ strcat (temp, spec_version);
+ strcat (temp, "/");
+ strcat (temp, spec_machine);
+ strcat (temp, "/");
+ gcc_exec_prefix = temp;
+ }
}
\f
/* Process a spec string, accumulating and running commands. */
arg_going = 1;
break;
+ case 'I':
+ if (gcc_exec_prefix)
+ {
+ do_spec_1 ("-imacros", 1, 0);
+ /* Make this a separate argument. */
+ do_spec_1 (" ", 0, 0);
+ do_spec_1 (gcc_exec_prefix, 1, 0);
+ do_spec_1 (" ", 0, 0);
+ }
+ break;
+
case 'o':
{
register int f;