mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-22 06:32:08 +00:00
gcc-plugins/stackleak: Avoid assignment for unused macro argument
With GCC version >= 8, the cgraph_create_edge() macro argument using "frequency" goes unused. Instead of assigning a temporary variable for the argument, pass the compute_call_stmt_bb_frequency() call directly as the macro argument so that it will just not be called when it is not wanted by the macros. Silences the warning: scripts/gcc-plugins/stackleak_plugin.c:54:6: warning: variable ‘frequency’ set but not used [-Wunused-but-set-variable] Now builds cleanly with gcc-7 and gcc-9. Both boot and pass STACKLEAK_ERASING LKDTM test. Signed-off-by: Kees Cook <keescook@chromium.org>
This commit is contained in:
parent
8f3d9f3542
commit
8d97fb393c
1 changed files with 2 additions and 3 deletions
|
@ -51,7 +51,6 @@ static void stackleak_add_track_stack(gimple_stmt_iterator *gsi, bool after)
|
||||||
gimple stmt;
|
gimple stmt;
|
||||||
gcall *stackleak_track_stack;
|
gcall *stackleak_track_stack;
|
||||||
cgraph_node_ptr node;
|
cgraph_node_ptr node;
|
||||||
int frequency;
|
|
||||||
basic_block bb;
|
basic_block bb;
|
||||||
|
|
||||||
/* Insert call to void stackleak_track_stack(void) */
|
/* Insert call to void stackleak_track_stack(void) */
|
||||||
|
@ -68,9 +67,9 @@ static void stackleak_add_track_stack(gimple_stmt_iterator *gsi, bool after)
|
||||||
bb = gimple_bb(stackleak_track_stack);
|
bb = gimple_bb(stackleak_track_stack);
|
||||||
node = cgraph_get_create_node(track_function_decl);
|
node = cgraph_get_create_node(track_function_decl);
|
||||||
gcc_assert(node);
|
gcc_assert(node);
|
||||||
frequency = compute_call_stmt_bb_frequency(current_function_decl, bb);
|
|
||||||
cgraph_create_edge(cgraph_get_node(current_function_decl), node,
|
cgraph_create_edge(cgraph_get_node(current_function_decl), node,
|
||||||
stackleak_track_stack, bb->count, frequency);
|
stackleak_track_stack, bb->count,
|
||||||
|
compute_call_stmt_bb_frequency(current_function_decl, bb));
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool is_alloca(gimple stmt)
|
static bool is_alloca(gimple stmt)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue