Skip to content
This repository has been archived by the owner on May 9, 2024. It is now read-only.

[Warns] Reduce warnings amount #523

Merged
merged 1 commit into from
Jul 3, 2023
Merged

Conversation

Devjiu
Copy link
Contributor

@Devjiu Devjiu commented Jun 12, 2023

This commit is an initial step to remove warnings from build. Currently
it's focused on linux build.

Always_inline attribute warning works incorrectly. In this case we want
to keep symbol and than inline it during target llvm ir optimisation.

See also: #521

Signed-off-by: Dmitrii Makarenko [email protected]

@Devjiu Devjiu requested review from kurapov-peter and ienkovich and removed request for kurapov-peter June 12, 2023 17:58
@Devjiu
Copy link
Contributor Author

Devjiu commented Jun 12, 2023

Replacing with FORCE_INLINE does not help for:

/localdisk/dmitriim/hdk/omniscidb/Utils/ExtractFromTime.cpp:199:30: warning: 'always_inline' function might not be inlinable [-Wattributes]
  199 | ALWAYS_INLINE DEVICE int64_t extract_week(const int64_t timeval) {

In this case looks like we should use simple inline. Is this an acceptable approach?

Copy link
Contributor

@alexbaden alexbaden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also remove the FORCE and ALWAYS inline changes for now? I think that will require more thought. Let's tackle the other warnings now and look at inline warnings later.

float64_builder.AppendValues({});
float64_builder.Finish(&empty_array);
// auto status = float64_builder.AppendValues({});
ASSERT_TRUE(float64_builder.AppendValues({}).ok());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a macro you can use here -- ARROW_THROW_NOT_OK I believe.

@@ -37,7 +37,7 @@ class AnnotateInternalFunctionsPass
llvm::CGSCCAnalysisManager& AM,
llvm::LazyCallGraph& CG,
llvm::CGSCCUpdateResult& UR) {
bool updated_function_defs = false;
[[maybe_unused]] bool updated_function_defs = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this is actually not used? @lmontigny

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confirm, it's not used

const std::string& getFieldName(size_t i) const override {
CHECK(false);
// just a stub, shouldn't be reached.
return op_type_;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommend returning empty string "" instead of a member var, since the return is not meaningful b/c the function is not implemented.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning a reference to a local object would produce another warning though. I wonder if we can modify CHECK in such a way that the compiler would understand what we actually call abort. Or maybe use some new macro like FAIL to avoid unreachable return statements.

@Devjiu Devjiu force-pushed the dmitriim/add_return_stmnt branch 2 times, most recently from a6590f5 to 6d4c150 Compare June 14, 2023 17:39
@Devjiu
Copy link
Contributor Author

Devjiu commented Jun 14, 2023

Can you also remove the FORCE and ALWAYS inline changes for now? I think that will require more thought. Let's tackle the other warnings now and look at inline warnings later.

Sure, It was an initial approach. AFAIU Force inline removes symbol for this function and we can't call it on runtime, so many tests are failed with forced. Looks like warning generated by gcc is incorrect for our case - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55830 . So I just suppressed it.

CMakeLists.txt Outdated
@@ -15,6 +15,7 @@ project(

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS 1 CACHE INTERNAL "No dev warnings")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was able to fix the cmake warning here: #531

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool) I also tried in the same way, but didn't assume that the extra space would resolve it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the warning is fixed we need to remove this item.

const std::string& getFieldName(size_t i) const override { CHECK(false); }
const std::string& getFieldName(size_t i) const override {
CHECK(false);
// Check(false) macro have abort in Logger d-tor,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just return an empty string, nobody will ever actually access it (b/c of the CHECK), and that is consistent with the rest of the code base.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, but signature with const ref don't allow to return "" here. I checked and get returning address of local variable or temporary or something like this, I can WA with static const std::string.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also throw an exception instead of return to resolve the warning.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I guess we can leave the abort if it builds fine w/ gcc and clang.

CMakeLists.txt Outdated
@@ -15,6 +15,7 @@ project(

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS 1 CACHE INTERNAL "No dev warnings")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the warning is fixed we need to remove this item.

const std::string& getFieldName(size_t i) const override { CHECK(false); }
const std::string& getFieldName(size_t i) const override {
CHECK(false);
// Check(false) macro have abort in Logger d-tor,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I guess we can leave the abort if it builds fine w/ gcc and clang.

@alexbaden
Copy link
Contributor

@Devjiu can you address #523 (comment) so we can merge this? It would be nice to suppress some of these warnings.

@Devjiu Devjiu force-pushed the dmitriim/add_return_stmnt branch 2 times, most recently from d91de20 to becdd8c Compare June 30, 2023 13:21
@Devjiu Devjiu marked this pull request as ready for review June 30, 2023 13:21
This commit is an initial step to remove warnings from build. Currently
it's focused on linux gcc configuration.

Always_inline attribute warning works incorrectly. In this case we want
to keep symbol and than inline it during target llvm ir optimisation.

See also: #521

Signed-off-by: Dmitrii Makarenko <[email protected]>
@Devjiu Devjiu force-pushed the dmitriim/add_return_stmnt branch from becdd8c to bf845d8 Compare June 30, 2023 14:46
@kurapov-peter kurapov-peter merged commit 9d3fcf0 into main Jul 3, 2023
@kurapov-peter kurapov-peter deleted the dmitriim/add_return_stmnt branch July 3, 2023 12:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants