#ifndef WCHAR_TYPE
#define WCHAR_TYPE "int"
#endif
+
+#ifndef WINT_TYPE
+#define WINT_TYPE "unsigned int"
+#endif
\f
/* Do GC. */
int ggc_p = 1;
int flag_traditional;
+/* Nonzero means enable C89 Amendment 1 features, other than digraphs. */
+
+int flag_isoc94 = 0;
+
/* Nonzero means use the ISO C99 dialect of C. */
int flag_isoc99 = 0;
/* Nonzero means message about use of implicit function declarations;
1 means warning; 2 means error. */
-int mesg_implicit_function_declaration;
+int mesg_implicit_function_declaration = -1;
/* Nonzero means give string constants the type `const char *'
to get extra warnings from them. These warnings will be too numerous
{
iso_1990:
flag_digraphs = 0;
+ flag_isoc94 = 0;
iso_1990_digraphs:
flag_traditional = 0;
flag_writable_strings = 0;
else if (!strcmp (argstart, "iso9899:199409"))
{
flag_digraphs = 1;
- /* ??? The other changes since ISO C 1990 are not supported. */
+ flag_isoc94 = 1;
goto iso_1990_digraphs;
}
else if (!strcmp (argstart, "iso9899:199x")
flag_no_nonansi_builtin = 1;
flag_isoc99 = 1;
flag_digraphs = 1;
+ flag_isoc94 = 1;
}
else if (!strcmp (argstart, "gnu89"))
{
flag_no_nonansi_builtin = 0;
flag_isoc99 = 0;
flag_digraphs = 1;
+ flag_isoc94 = 0;
}
else if (!strcmp (argstart, "gnu9x") || !strcmp (argstart, "gnu99"))
{
flag_no_nonansi_builtin = 0;
flag_isoc99 = 1;
flag_digraphs = 1;
+ flag_isoc94 = 1;
}
else
error ("unknown C standard `%s'", argstart);
rest_of_decl_compilation (decl, NULL_PTR, 0, 0);
- if (mesg_implicit_function_declaration && implicit_warning)
- {
- if (mesg_implicit_function_declaration == 2)
- error ("implicit declaration of function `%s'",
- IDENTIFIER_POINTER (functionid));
- else
- warning ("implicit declaration of function `%s'",
- IDENTIFIER_POINTER (functionid));
- }
+ if (implicit_warning)
+ implicit_decl_warning (functionid);
else if (warn_traditional && traditional_warning)
warning ("function `%s' was previously declared within a block",
IDENTIFIER_POINTER (functionid));
return decl;
}
+void
+implicit_decl_warning (id)
+ tree id;
+{
+ char *name = IDENTIFIER_POINTER (id);
+ if (mesg_implicit_function_declaration == 2)
+ error ("implicit declaration of function `%s'", name);
+ else if (mesg_implicit_function_declaration == 1)
+ warning ("implicit declaration of function `%s'", name);
+}
+
/* Return zero if the declaration NEWDECL is valid
when the declaration OLDDECL (assumed to be for the same name)
has already been seen.
Note that stddef.h uses `unsigned long',
and this must agree, even if long and int are the same size. */
t = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (SIZE_TYPE)));
+ signed_size_type_node = signed_type (t);
if (flag_traditional && TREE_UNSIGNED (t))
t = signed_type (t);
signed_wchar_type_node = signed_type (wchar_type_node);
unsigned_wchar_type_node = unsigned_type (wchar_type_node);
+ wint_type_node = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (WINT_TYPE)));
+
boolean_type_node = integer_type_node;
boolean_true_node = integer_one_node;
boolean_false_node = integer_zero_node;
= build_function_type (integer_type_node, NULL_TREE);
ptrdiff_type_node
= TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (PTRDIFF_TYPE)));
+ unsigned_ptrdiff_type_node = unsigned_type (ptrdiff_type_node);
c_common_nodes_and_builtins (0, flag_no_builtin, flag_no_nonansi_builtin);
tree new_parms = 0;
tree order = current_binding_level->parm_order;
- /* Just `void' (and no ellipsis) is special. There are really no parms. */
+ /* Just `void' (and no ellipsis) is special. There are really no parms.
+ But if the `void' is qualified (by `const' or `volatile') or has a
+ storage class specifier (`register'), then the behavior is undefined;
+ by not counting it as the special case of `void' we will cause an
+ error later. Typedefs for `void' are OK (see DR#157).
+ */
if (void_at_end && parms != 0
&& TREE_CHAIN (parms) == 0
&& VOID_TYPE_P (TREE_TYPE (parms))
+ && ! TREE_THIS_VOLATILE (parms)
+ && ! TREE_READONLY (parms)
+ && ! DECL_REGISTER (parms)
&& DECL_NAME (parms) == 0)
{
parms = NULL_TREE;
setjmp_protect_args ();
}
- if (! strcmp (IDENTIFIER_POINTER (DECL_NAME (fndecl)), "main"))
+ if (! strcmp (IDENTIFIER_POINTER (DECL_NAME (fndecl)), "main")
+ && flag_hosted)
{
if (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (fndecl)))
!= integer_type_node)
#ifdef DEFAULT_MAIN_RETURN
/* Make it so that `main' always returns success by default. */
DEFAULT_MAIN_RETURN;
+#else
+ if (flag_isoc99)
+ c_expand_return (integer_zero_node);
#endif
}
}