disable warnings as erros

mairswartz
Posts: 21
Joined: Tue Nov 07, 2017 9:59 pm

disable warnings as erros

Postby mairswartz » Wed Oct 14, 2020 5:09 am

Hi,
I'm trying to integrate a third party library with the IDF.
When I try to compile I get the following error

Code: Select all

 error: 'func' may be used uninitialized in this function [-Werror=maybe-uninitialized]
I'm looking at cmakelists.txt target_compile_options but I cant find any examples of how to disable the warning
Any help would be appreciated,

Thanks
check out my course https://learnesp32.com

nvannote
Posts: 51
Joined: Thu Nov 14, 2019 10:42 pm

Re: disable warnings as erros

Postby nvannote » Wed Oct 14, 2020 5:03 pm

The compiler flag your looking for is -Wno-maybe-uninitialized.

Best Regards

mairswartz
Posts: 21
Joined: Tue Nov 07, 2017 9:59 pm

Re: disable warnings as erros

Postby mairswartz » Wed Oct 14, 2020 9:43 pm

Thanks @nvannote
The compiler flag your looking for is -Wno-maybe-uninitialized.
Do you have an example on how to switch it off. Its seems on my default

I've tried

Code: Select all

target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-maybe-uninitialized=0)
but that didn't work
looking at https://docs.espressif.com/projects/esp ... -variables
It seems I need to switch it off in the root cmakelists.txt

I've tried

Code: Select all

cmake_minimum_required(VERSION 3.5)

set(WARN_UNINITIALIZED 0)

include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(proj)
but that didn't work either. It maybe my syntax is wrong. I'm still getting familiar with cmake
check out my course https://learnesp32.com

nvannote
Posts: 51
Joined: Thu Nov 14, 2019 10:42 pm

Re: disable warnings as erros

Postby nvannote » Thu Oct 15, 2020 2:54 am

I have done this with IDF in the past. In my case I was porting a library specifically as a component.

After your idf_component_register, you can add a line...

Code: Select all

set_target_properties(${COMPONENT_LIB} PROPERTIES COMPILE_FLAGS -Wno-maybe-uninitialized)
In my case, and perhaps you would like to do similar; I singled out the specific offending source file.

Code: Select all

set_source_files_properties(your/path/to/source/file/here.c PROPERTIES COMPILE_FLAGS -Wno-maybe-uninitialized)
Best Regards


Footnote:

While this will get around the immediate issue, I will note that compilers are pretty good at catching such things and rarely make a fuss unless its real. I would take a look at the source in question and verify and/or bring it to the attention of the maintainer of the library.

mairswartz
Posts: 21
Joined: Tue Nov 07, 2017 9:59 pm

Re: disable warnings as erros

Postby mairswartz » Thu Oct 15, 2020 7:39 am

@ nvannote
Brilliant!
That works perfectly.

Thank you vary much :D
check out my course https://learnesp32.com

Who is online

Users browsing this forum: No registered users and 82 guests