#include "target.h"
#include "langhooks.h"
#include "tree-inline.h"
-
+#include "c-tree.h"
cpp_reader *parse_in; /* Declared in c-pragma.h. */
int flag_const_strings;
-/* Nonzero means `$' can be in an identifier. */
-
-#ifndef DOLLARS_IN_IDENTIFIERS
-#define DOLLARS_IN_IDENTIFIERS 1
-#endif
-int dollars_in_ident = DOLLARS_IN_IDENTIFIERS;
-
/* Nonzero means to treat bitfields as signed unless they say `unsigned'. */
int flag_signed_bitfields = 1;
int warn_missing_braces;
/* Warn about comparison of signed and unsigned values.
- If -1, neither -Wsign-compare nor -Wno-sign-compare has been specified. */
+ If -1, neither -Wsign-compare nor -Wno-sign-compare has been specified
+ (in which case -Wextra gets to decide). */
-int warn_sign_compare;
+int warn_sign_compare = -1;
/* Nonzero means warn about usage of long long when `-pedantic'. */
int warn_abi = 0;
+/* Nonzero means warn about invalid uses of offsetof. */
+
+int warn_invalid_offsetof = 1;
+
/* Nonzero means warn about implicit declarations. */
int warn_implicit = 1;
/* Nonzero means warn when all ctors or dtors are private, and the class
has no friends. */
-int warn_ctor_dtor_privacy = 1;
+int warn_ctor_dtor_privacy = 0;
/* Nonzero means warn in function declared in derived class has the
same name as a virtual in the base class, but fails to match the
bool *));
static tree handle_nothrow_attribute PARAMS ((tree *, tree, tree, int,
bool *));
+static tree handle_cleanup_attribute PARAMS ((tree *, tree, tree, int,
+ bool *));
static tree vector_size_helper PARAMS ((tree, tree));
static void check_function_nonnull PARAMS ((tree, tree));
{ "nothrow", 0, 0, true, false, false,
handle_nothrow_attribute },
{ "may_alias", 0, 0, false, true, false, NULL },
+ { "cleanup", 1, 1, true, false, false,
+ handle_cleanup_attribute },
{ NULL, 0, 0, false, false, false, NULL }
};
/* Record this if statement. */
if_stack[if_stack_pointer].compstmt_count = compstmt_count;
- if_stack[if_stack_pointer].locus.file = input_filename;
- if_stack[if_stack_pointer].locus.line = lineno;
+ if_stack[if_stack_pointer].locus = input_location;
if_stack[if_stack_pointer].needs_warning = 0;
if_stack[if_stack_pointer].if_stmt = if_stmt;
if_stack_pointer++;
beginning of the function and this line number will be wrong.
To avoid this problem set the lineno to 0 here; that prevents
it from appearing in the RTL. */
- int saved_lineno = lineno;
- lineno = 0;
+ int saved_lineno = input_line;
+ input_line = 0;
decl = (*make_fname_decl) (id, fname_vars[ix].pretty);
if (last_tree != saved_last_tree)
saved_function_name_decls);
}
*fname_vars[ix].decl = decl;
- lineno = saved_lineno;
+ input_line = saved_lineno;
}
if (!ix && !current_function_decl)
pedwarn_with_decl (decl, "`%s' is not defined outside of function scope");
return NULL_TREE;
}
+
+/* Handle a "cleanup" attribute; arguments as in
+ struct attribute_spec.handler. */
+
+static tree
+handle_cleanup_attribute (node, name, args, flags, no_add_attrs)
+ tree *node;
+ tree name;
+ tree args;
+ int flags ATTRIBUTE_UNUSED;
+ bool *no_add_attrs;
+{
+ tree decl = *node;
+ tree cleanup_id, cleanup_decl;
+
+ /* ??? Could perhaps support cleanups on TREE_STATIC, much like we do
+ for global destructors in C++. This requires infrastructure that
+ we don't have generically at the moment. It's also not a feature
+ we'd be missing too much, since we do have attribute constructor. */
+ if (TREE_CODE (decl) != VAR_DECL || TREE_STATIC (decl))
+ {
+ warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
+ *no_add_attrs = true;
+ return NULL_TREE;
+ }
+
+ /* Verify that the argument is a function in scope. */
+ /* ??? We could support pointers to functions here as well, if
+ that was considered desirable. */
+ cleanup_id = TREE_VALUE (args);
+ if (TREE_CODE (cleanup_id) != IDENTIFIER_NODE)
+ {
+ error ("cleanup arg not an identifier");
+ *no_add_attrs = true;
+ return NULL_TREE;
+ }
+ cleanup_decl = lookup_name (cleanup_id);
+ if (!cleanup_decl || TREE_CODE (cleanup_decl) != FUNCTION_DECL)
+ {
+ error ("cleanup arg not a function");
+ *no_add_attrs = true;
+ return NULL_TREE;
+ }
+
+ /* That the function has proper type is checked with the
+ eventual call to build_function_call. */
+
+ return NULL_TREE;
+}
\f
/* Check for valid arguments being passed to a function. */
void