Skip to content

EEPROM class is throwing a warning: converting to non-pointer type 'nvs_handle {aka unsigned int}' from NULL #3142

Closed
@CircuitSetup

Description

@CircuitSetup

Hardware:

Board: ESP32 Dev Module
Core Installation version: 1.0.3-rc2
IDE name: Arduino IDE
Flash Frequency: 40Mhz
PSRAM enabled: no
Upload Speed: 115200
Computer OS: Windows 10

Description:

The constructor for the EEPROM class is throwing a warning when compiling:

C:\Users\User\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.3-rc2\libraries\EEPROM\src\EEPROM.cpp: In constructor 'EEPROMClass::EEPROMClass()':

C:\Users\User\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.3-rc2\libraries\EEPROM\src\EEPROM.cpp:37:25: warning: converting to non-pointer type 'nvs_handle {aka unsigned int}' from NULL [-Wconversion-null]

   , _user_defined_size(0)

                         ^

C:\Users\User\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.3-rc2\libraries\EEPROM\src\EEPROM.cpp: In constructor 'EEPROMClass::EEPROMClass(uint32_t)':

C:\Users\User\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.3-rc2\libraries\EEPROM\src\EEPROM.cpp:48:25: warning: converting to non-pointer type 'nvs_handle {aka unsigned int}' from NULL [-Wconversion-null]

   , _user_defined_size(0)

                         ^

C:\Users\User\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.3-rc2\libraries\EEPROM\src\EEPROM.cpp: In constructor 'EEPROMClass::EEPROMClass(const char*, uint32_t)':

C:\Users\User\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.3-rc2\libraries\EEPROM\src\EEPROM.cpp:58:41: warning: converting to non-pointer type 'nvs_handle {aka unsigned int}' from NULL [-Wconversion-null]

   , _user_defined_size(user_defined_size)

Activity

lbernstone

lbernstone commented on Aug 27, 2019

@lbernstone
Contributor

Works correctly, just throwing the warning?

CircuitSetup

CircuitSetup commented on Aug 29, 2019

@CircuitSetup
Author

I havent tested all of the functions. Writing and getting data to EEPROM seems to be working properly.

C47D

C47D commented on Sep 1, 2019

@C47D

Just tried to replicate this with the eeprom_class.ino example and I am not getting any warnings. I have enabled all the warnings on the Preferences menu.

imagen

Mind sharing your test code?

CircuitSetup

CircuitSetup commented on Sep 1, 2019

@CircuitSetup
Author

Thanks for checking! The EEPROM functions I'm using are located here: https://github.com/CircuitSetup/Split-Single-Phase-Energy-Meter/blob/master/Software/EmonESP/src/config.cpp

I wouldn't doubt if it's something simple that I'm missing since nothing was changed between 1.0.2 to 1.0.3 rc2

lbernstone

lbernstone commented on Sep 1, 2019

@lbernstone
Contributor

Oh, it definitely is an issue. I will fix it, just don't have time to test right now. It will make it into the 1.0.4 release.

CircuitSetup

CircuitSetup commented on Sep 1, 2019

@CircuitSetup
Author

Oh, it definitely is an issue. I will fix it, just don't have time to test right now. It will make it into the 1.0.4 release.

What specifically would this be affecting?

lbernstone

lbernstone commented on Sep 1, 2019

@lbernstone
Contributor

It will make the message go away. As mentioned in the message, it is a warning.

C47D

C47D commented on Sep 2, 2019

@C47D

@CircuitSetup, thanks for the link, I will take a look at it and use the 1.0.3 rc2 branch, I test it only with the 1.0.2 stable.

@lbernstone, cool, I was planning to try to understand the issue and fix it.

I am more familiar with C code, so, is the issue because of the initializer list on the EEPROM constructor? The 0 should have a UL at the end to let the compiler know to treat the 0 as an uint32_t value?

lbernstone

lbernstone commented on Sep 2, 2019

@lbernstone
Contributor

It says exactly what the issue is, even though it points to the wrong line of code. I am treating nvs_handle like a pointer, but it is a uint32_t, which should not be set to NULL.

C47D

C47D commented on Sep 2, 2019

@C47D

Silly me, i was looking at _user_defined_size all the time, it points to the wrong line of code indeed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      EEPROM class is throwing a warning: converting to non-pointer type 'nvs_handle {aka unsigned int}' from NULL · Issue #3142 · espressif/arduino-esp32