From 2f08904cd8605b69814a8a38fb6aa46b279ece31 Mon Sep 17 00:00:00 2001 From: Benjamin Welton Date: Fri, 5 Jan 2024 15:20:11 -0800 Subject: [PATCH] Build fixes for clang 10 (#339) * Build fixes for clang 10 fixes build warnings in clang10 * source formatting (clang-format v11) (#340) Co-authored-by: bwelton --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: bwelton [ROCm/rocprofiler-sdk commit: 0dd0cad2e4ec31f06339784ea1fea76d51fe5e3f] --- .../cmake/rocprofiler_build_settings.cmake | 2 ++ .../counters/tests/evaluate_ast_test.cpp | 24 +++++++++---------- .../tests/kernel-tracing/kernel-tracing.cpp | 2 +- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/projects/rocprofiler-sdk/cmake/rocprofiler_build_settings.cmake b/projects/rocprofiler-sdk/cmake/rocprofiler_build_settings.cmake index a781a00f3d..8b39731afe 100644 --- a/projects/rocprofiler-sdk/cmake/rocprofiler_build_settings.cmake +++ b/projects/rocprofiler-sdk/cmake/rocprofiler_build_settings.cmake @@ -176,6 +176,8 @@ if(ROCPROFILER_UNSAFE_NO_VERSION_CHECK) INTERFACE ROCPROFILER_UNSAFE_NO_VERSION_CHECK) endif() +rocprofiler_target_compile_definitions(rocprofiler-build-flags INTERFACE YY_NO_INPUT) + # ----------------------------------------------------------------------------------------# # user customization # diff --git a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/counters/tests/evaluate_ast_test.cpp b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/counters/tests/evaluate_ast_test.cpp index b008bb59f2..799b464986 100644 --- a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/counters/tests/evaluate_ast_test.cpp +++ b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/counters/tests/evaluate_ast_test.cpp @@ -100,7 +100,7 @@ TEST(evaluate_ast, counter_expansion) : metric.expression().c_str()); yyparse(&ast); ASSERT_TRUE(ast); - asts.emplace(val, std::move(EvaluateAST({.handle = metric.id()}, metrics, *ast, "gfx9"))); + asts.emplace(val, EvaluateAST({.handle = metric.id()}, metrics, *ast, "gfx9")); yy_delete_buffer(buf); delete ast; } @@ -135,7 +135,7 @@ TEST(evaluate_ast, counter_expansion_multi_derived) : metric.expression().c_str()); yyparse(&ast); ASSERT_TRUE(ast); - asts.emplace(val, std::move(EvaluateAST({.handle = metric.id()}, metrics, *ast, "gfx9"))); + asts.emplace(val, EvaluateAST({.handle = metric.id()}, metrics, *ast, "gfx9")); yy_delete_buffer(buf); delete ast; } @@ -170,7 +170,7 @@ TEST(evaluate_ast, counter_expansion_order) : metric.expression().c_str()); yyparse(&ast); ASSERT_TRUE(ast); - asts.emplace(val, std::move(EvaluateAST({.handle = metric.id()}, metrics, *ast, "gfx9"))); + asts.emplace(val, EvaluateAST({.handle = metric.id()}, metrics, *ast, "gfx9")); yy_delete_buffer(buf); delete ast; } @@ -204,7 +204,7 @@ TEST(evaluate_ast, counter_expansion_function) : metric.expression().c_str()); yyparse(&ast); ASSERT_TRUE(ast) << metric.expression() << " " << metric.name(); - asts.emplace(val, std::move(EvaluateAST({.handle = metric.id()}, metrics, *ast, "gfx9"))); + asts.emplace(val, EvaluateAST({.handle = metric.id()}, metrics, *ast, "gfx9")); yy_delete_buffer(buf); delete ast; } @@ -256,8 +256,8 @@ TEST(evaluate_ast, counter_constants) yyparse(&ast); ASSERT_TRUE(ast) << metric.expression() << " " << metric.name(); asts.emplace("gfx9", std::unordered_map{}) - .first->second.emplace( - val, std::move(EvaluateAST({.handle = metric.id()}, metrics, *ast, "gfx9"))); + .first->second.emplace(val, + EvaluateAST({.handle = metric.id()}, metrics, *ast, "gfx9")); yy_delete_buffer(buf); delete ast; } @@ -448,8 +448,8 @@ TEST(evaluate_ast, evaluate_simple_counters) yyparse(&ast); ASSERT_TRUE(ast) << metric.expression() << " " << metric.name(); asts.emplace("gfx9", std::unordered_map{}) - .first->second.emplace( - val, std::move(EvaluateAST({.handle = metric.id()}, metrics, *ast, "gfx9"))); + .first->second.emplace(val, + EvaluateAST({.handle = metric.id()}, metrics, *ast, "gfx9")); yy_delete_buffer(buf); delete ast; } @@ -544,8 +544,8 @@ run_reduce_test( yyparse(&ast); ASSERT_TRUE(ast) << metric.expression() << " " << metric.name(); asts.emplace("gfx9", std::unordered_map{}) - .first->second.emplace( - val, std::move(EvaluateAST({.handle = metric.id()}, metrics, *ast, "gfx9"))); + .first->second.emplace(val, + EvaluateAST({.handle = metric.id()}, metrics, *ast, "gfx9")); yy_delete_buffer(buf); delete ast; } @@ -975,8 +975,8 @@ TEST(evaluate_ast, evaluate_mixed_counters) yyparse(&ast); ASSERT_TRUE(ast) << metric.expression() << " " << metric.name(); asts.emplace("gfx9", std::unordered_map{}) - .first->second.emplace( - val, std::move(EvaluateAST({.handle = metric.id()}, metrics, *ast, "gfx9"))); + .first->second.emplace(val, + EvaluateAST({.handle = metric.id()}, metrics, *ast, "gfx9")); yy_delete_buffer(buf); delete ast; } diff --git a/projects/rocprofiler-sdk/tests/kernel-tracing/kernel-tracing.cpp b/projects/rocprofiler-sdk/tests/kernel-tracing/kernel-tracing.cpp index a7ca50ae54..551cef4e6f 100644 --- a/projects/rocprofiler-sdk/tests/kernel-tracing/kernel-tracing.cpp +++ b/projects/rocprofiler-sdk/tests/kernel-tracing/kernel-tracing.cpp @@ -639,7 +639,7 @@ tool_init(rocprofiler_client_finalize_t fini_func, void* tool_data) void tool_fini(void* tool_data) { - static auto _once = std::atomic_flag{ATOMIC_FLAG_INIT}; + static std::atomic_flag _once = ATOMIC_FLAG_INIT; if(_once.test_and_set()) return; stop();