Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(129)

Unified Diff: gcc/c-family/c-common.c

Issue 7301068: [google] Port revisions for -mpatch-functions-for-instrumentation option back to google-main.
Patch Set: [google] Port revisions for -mpatch-functions-for-instrumentation option back to google-main. Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gcc/config/i386/i386.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gcc/c-family/c-common.c
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 71c4b49..37adb4a 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -367,6 +367,13 @@ static tree ignore_attribute (tree *, tree, tree, int, bool *);
static tree handle_no_split_stack_attribute (tree *, tree, tree, int, bool *);
static tree handle_fnspec_attribute (tree *, tree, tree, int, bool *);
+static tree handle_always_patch_for_instrumentation_attribute (tree *, tree,
+ tree, int,
+ bool *);
+static tree handle_never_patch_for_instrumentation_attribute (tree *, tree,
+ tree, int,
+ bool *);
+
static void check_function_nonnull (tree, int, tree *);
static void check_nonnull_arg (void *, tree, unsigned HOST_WIDE_INT);
static bool nonnull_check_p (tree, unsigned HOST_WIDE_INT);
@@ -733,6 +740,13 @@ const struct attribute_spec c_common_attribute_table[] =
The name contains space to prevent its usage in source code. */
{ "fn spec", 1, 1, false, true, true,
handle_fnspec_attribute, false },
+ { "always_patch_for_instrumentation", 0, 0, true, false, false,
+ handle_always_patch_for_instrumentation_attribute,
+ false },
+ { "never_patch_for_instrumentation", 0, 0, true, false, false,
+ handle_never_patch_for_instrumentation_attribute,
+ false },
+
{ NULL, 0, 0, false, false, false, NULL, false }
};
@@ -8446,6 +8460,47 @@ handle_nonnull_attribute (tree *node, tree ARG_UNUSED (name),
return NULL_TREE;
}
+/* Handle a "always_patch_for_instrumentation" attribute; arguments as in
+ struct attribute_spec.handler. */
+
+static tree
+handle_always_patch_for_instrumentation_attribute (tree *node, tree name,
+ tree ARG_UNUSED (args),
+ int ARG_UNUSED (flags),
+ bool *no_add_attrs)
+{
+ if (TREE_CODE (*node) == FUNCTION_DECL)
+ {
+ /* Disable inlining if forced instrumentation. */
+ DECL_UNINLINABLE (*node) = 1;
+ }
+ else
+ {
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
+ *no_add_attrs = true;
+ }
+ return NULL_TREE;
+}
+
+
+/* Handle a "never_patch_for_instrumentation" attribute; arguments as in
+ struct attribute_spec.handler. */
+
+static tree
+handle_never_patch_for_instrumentation_attribute (tree *node, tree name,
+ tree ARG_UNUSED (args),
+ int ARG_UNUSED (flags),
+ bool *no_add_attrs)
+{
+ if (TREE_CODE (*node) != FUNCTION_DECL)
+ {
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
+ *no_add_attrs = true;
+ }
+ return NULL_TREE;
+}
+
+
/* Check the argument list of a function call for null in argument slots
that are marked as requiring a non-null pointer argument. The NARGS
arguments are passed in the array ARGARRAY.
« no previous file with comments | « no previous file | gcc/config/i386/i386.c » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b