Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New build warnings on Ubuntu 24 #252

Open
dchassin opened this issue Sep 27, 2024 · 0 comments
Open

New build warnings on Ubuntu 24 #252

dchassin opened this issue Sep 27, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@dchassin
Copy link
Member

dchassin commented Sep 27, 2024

Problem description

The following warnings are emitted during ubuntu_24-x86_64 builds.

In file included from module/influxdb/database.h:10,
                 from module/influxdb/database.cpp:6:
In member function 'void gld_string::copy(const char*)',
    inlined from 'gld_string& gld_string::operator=(const char*)' at ./source/gridlabd.h:1780:52,
    inlined from 'gld_string gld_global::get_string(size_t)' at ./source/gridlabd.h:3448:10,
    inlined from 'void measurements::add_tag(const char*, gld_global&)' at module/influxdb/database.cpp:810:74:
./source/gridlabd.h:1816:53: warning: 'buf' may be used uninitialized [-Wmaybe-uninitialized]
 1816 |         inline void copy(const char *s) { fit(strlen(s)+1); strcpy(buf->str,s); };
      |                                               ~~~~~~^~~
In file included from module/influxdb/jsondata.h:568,
                 from module/influxdb/database.h:9:
/usr/include/string.h: In member function 'void measurements::add_tag(const char*, gld_global&)':
/usr/include/string.h:407:15: note: by argument 1 of type 'const char*' to 'size_t strlen(const char*)' declared here
  407 | extern size_t strlen (const char *__s)
      |               ^~~~~~
./source/gridlabd.h:3445:22: note: 'buf' declared here
 3445 |                 char buf[1024];
      |                      ^~~
In member function 'void gld_string::copy(const char*)',
    inlined from 'gld_string& gld_string::operator=(const char*)' at ./source/gridlabd.h:1780:52,
    inlined from 'gld_string gld_global::get_string(size_t)' at ./source/gridlabd.h:3448:10,
    inlined from 'void measurements::add_field(const char*, gld_global&)' at module/influxdb/database.cpp:886:123:
./source/gridlabd.h:1816:53: warning: 'buf' may be used uninitialized [-Wmaybe-uninitialized]
 1816 |         inline void copy(const char *s) { fit(strlen(s)+1); strcpy(buf->str,s); };
      |                                               ~~~~~~^~~
/usr/include/string.h: In member function 'void measurements::add_field(const char*, gld_global&)':
/usr/include/string.h:407:15: note: by argument 1 of type 'const char*' to 'size_t strlen(const char*)' declared here
  407 | extern size_t strlen (const char *__s)
      |               ^~~~~~
./source/gridlabd.h:3445:22: note: 'buf' declared here
 3445 |                 char buf[1024];
      |                      ^~~
In member function 'void ArduinoJson6140_1100000::VariantData::setType(uint8_t)',
    inlined from 'void ArduinoJson6140_1100000::VariantData::setNull()' at module/influxdb/jsondata.h:1517:12,
    inlined from 'ArduinoJson6140_1100000::JsonDocument::JsonDocument(ArduinoJson6140_1100000::MemoryPool)' at module/influxdb/jsondata.h:3382:18,
    inlined from 'ArduinoJson6140_1100000::BasicJsonDocument<TAllocator>::BasicJsonDocument(size_t, TAllocator) [with TAllocator = ArduinoJson6140_1100000::DefaultAllocator]' at module/influxdb/jsondata.h:3421:76,
    inlined from 'ArduinoJson6140_1100000::DynamicJsonDocument auto_deserialize(const char*, size_t)' at module/influxdb/database.cpp:291:37:
module/influxdb/jsondata.h:1599:5: warning: 'result.ArduinoJson6140_1100000::BasicJsonDocument<ArduinoJson6140_1100000::DefaultAllocator>::<unnamed>.ArduinoJson6140_1100000::JsonDocument::_data.ArduinoJson6140_1100000::VariantData::_flags' may be used uninitialized [-Wmaybe-uninitialized]
 1599 |     _flags &= KEY_IS_OWNED;
      |     ^~~~~~
module/influxdb/database.cpp: In function 'ArduinoJson6140_1100000::DynamicJsonDocument auto_deserialize(const char*, size_t)':
module/influxdb/database.cpp:291:29: note: 'result' declared here
  291 |         DynamicJsonDocument result(1);
      |                             ^~~~~~
In member function 'void ArduinoJson6140_1100000::VariantData::setType(uint8_t)',
    inlined from 'void ArduinoJson6140_1100000::VariantData::setNull()' at module/influxdb/jsondata.h:1517:12,
    inlined from 'ArduinoJson6140_1100000::JsonDocument::JsonDocument(ArduinoJson6140_1100000::MemoryPool)' at module/influxdb/jsondata.h:3382:18,
    inlined from 'ArduinoJson6140_1100000::BasicJsonDocument<TAllocator>::BasicJsonDocument(size_t, TAllocator) [with TAllocator = ArduinoJson6140_1100000::DefaultAllocator]' at module/influxdb/jsondata.h:3421:76,
    inlined from 'ArduinoJson6140_1100000::DynamicJsonDocument auto_deserialize(const char*, size_t)' at module/influxdb/database.cpp:298:40:
module/influxdb/jsondata.h:1599:5: warning: 'result.ArduinoJson6140_1100000::BasicJsonDocument<ArduinoJson6140_1100000::DefaultAllocator>::<unnamed>.ArduinoJson6140_1100000::JsonDocument::_data.ArduinoJson6140_1100000::VariantData::_flags' may be used uninitialized [-Wmaybe-uninitialized]
 1599 |     _flags &= KEY_IS_OWNED;
      |     ^~~~~~
module/influxdb/database.cpp: In function 'ArduinoJson6140_1100000::DynamicJsonDocument auto_deserialize(const char*, size_t)':
module/influxdb/database.cpp:298:29: note: 'result' declared here
  298 |         DynamicJsonDocument result(size);
      |                             ^~~~~~
In file included from module/powerflow/powerflow.h:13,
                 from module/powerflow/capacitor.cpp:10:
In member function 'void gld_string::copy(const char*)',
    inlined from 'gld_string& gld_string::operator=(const char*)' at ./source/gridlabd.h:1780:52,
    inlined from 'gld_string gld_global::get_string(size_t)' at ./source/gridlabd.h:3448:10:
./source/gridlabd.h:1816:53: warning: 'buf' may be used uninitialized [-Wmaybe-uninitialized]
 1816 |         inline void copy(const char *s) { fit(strlen(s)+1); strcpy(buf->str,s); };
      |                                               ~~~~~~^~~
In file included from /usr/include/memory.h:29,
                 from ./source/gridlabd.h:100:
/usr/include/string.h: In member function 'gld_string gld_global::get_string(size_t)':
/usr/include/string.h:407:15: note: by argument 1 of type 'const char*' to 'size_t strlen(const char*)' declared here
  407 | extern size_t strlen (const char *__s)
      |               ^~~~~~
./source/gridlabd.h:3445:22: note: 'buf' declared here
 3445 |                 char buf[1024];
      |                      ^~~

  CXX      module/powerflow/powerflow_la-motor.lo
In file included from module/powerflow/powerflow.h:13,
                 from module/powerflow/link.cpp:5:
In member function 'void gld_string::copy(const char*)',
    inlined from 'gld_string& gld_string::operator=(const char*)' at ./source/gridlabd.h:1780:52,
    inlined from 'gld_string gld_global::get_string(size_t)' at ./source/gridlabd.h:3448:10:
./source/gridlabd.h:1816:53: warning: 'buf' may be used uninitialized [-Wmaybe-uninitialized]
 1816 |         inline void copy(const char *s) { fit(strlen(s)+1); strcpy(buf->str,s); };
      |                                               ~~~~~~^~~
In file included from /usr/include/memory.h:29,
                 from ./source/gridlabd.h:100:
/usr/include/string.h: In member function 'gld_string gld_global::get_string(size_t)':
/usr/include/string.h:407:15: note: by argument 1 of type 'const char*' to 'size_t strlen(const char*)' declared here
  407 | extern size_t strlen (const char *__s)
      |               ^~~~~~
./source/gridlabd.h:3445:22: note: 'buf' declared here
 3445 |                 char buf[1024];
      |                      ^~~
In file included from module/powerflow/powerflow.h:13,
                 from module/powerflow/node.cpp:50:
In member function 'void gld_string::copy(const char*)',
    inlined from 'gld_string& gld_string::operator=(const char*)' at ./source/gridlabd.h:1780:52,
    inlined from 'gld_string gld_global::get_string(size_t)' at ./source/gridlabd.h:3448:10:
./source/gridlabd.h:1816:53: warning: 'buf' may be used uninitialized [-Wmaybe-uninitialized]
 1816 |         inline void copy(const char *s) { fit(strlen(s)+1); strcpy(buf->str,s); };
      |                                               ~~~~~~^~~
In file included from /usr/include/memory.h:29,
                 from ./source/gridlabd.h:100:
/usr/include/string.h: In member function 'gld_string gld_global::get_string(size_t)':
/usr/include/string.h:407:15: note: by argument 1 of type 'const char*' to 'size_t strlen(const char*)' declared here
  407 | extern size_t strlen (const char *__s)
      |               ^~~~~~
./source/gridlabd.h:3445:22: note: 'buf' declared here
 3445 |                 char buf[1024];
      |                      ^~~
In file included from module/powerflow/powerflow.h:13,
                 from module/powerflow/regulator.cpp:11:
In member function 'void gld_string::copy(const char*)',
    inlined from 'gld_string& gld_string::operator=(const char*)' at ./source/gridlabd.h:1780:52,
    inlined from 'gld_string gld_global::get_string(size_t)' at ./source/gridlabd.h:3448:10:
./source/gridlabd.h:1816:53: warning: 'buf' may be used uninitialized [-Wmaybe-uninitialized]
 1816 |         inline void copy(const char *s) { fit(strlen(s)+1); strcpy(buf->str,s); };
      |                                               ~~~~~~^~~
In file included from /usr/include/memory.h:29,
                 from ./source/gridlabd.h:100:
/usr/include/string.h: In member function 'gld_string gld_global::get_string(size_t)':
/usr/include/string.h:407:15: note: by argument 1 of type 'const char*' to 'size_t strlen(const char*)' declared here
  407 | extern size_t strlen (const char *__s)
      |               ^~~~~~
./source/gridlabd.h:3445:22: note: 'buf' declared here
 3445 |                 char buf[1024];
      |                      ^~~
module/powerflow/solver_py.cpp: In function 'void solver_dump(unsigned int&, BUSDATA*&, unsigned int&, BRANCHDATA*&, bool)':
module/powerflow/solver_py.cpp:1570:40: warning: the address of 'phases' will never be NULL [-Waddress]
 1570 |                 if ( phases[b->phases] == NULL ) snprintf(phaseserr,sizeof(phaseserr)-1,"ERROR:%d",(int)b->phases);
      |                                        ^
module/powerflow/solver_py.cpp:1522:14: note: 'phases' declared here
 1522 |         char phases[256][9];
      |              ^~~~~~
module/powerflow/solver_py.cpp:1571:44: warning: the address of 'phases' will never be NULL [-Waddress]
 1571 |                 if ( phases[b->origphases] == NULL ) snprintf(origphaseserr,sizeof(origphaseserr)-1,"ERROR:%d",(int)b->origphases);
      |                                            ^
module/powerflow/solver_py.cpp:1522:14: note: 'phases' declared here
 1522 |         char phases[256][9];
      |              ^~~~~~
module/powerflow/solver_py.cpp:1595:107: warning: the address of 'phases' will never be NULL [-Waddress]
 1595 |                         m,b->name?b->name:"",bustype[b->type]?bustype[b->type]:bustypeerr,phases[b->phases]?phases[b->phases]:phaseserr,phases[b->origphases]?phases[b->origphases]:origphaseserr,*(b->busflag)<sizeof(busflag)/sizeof(busflag[0])?busflag[*(b->busflag)]:busflagerr,
      |                                                                                           ~~~~~~~~~~~~~~~~^
module/powerflow/solver_py.cpp:1522:14: note: 'phases' declared here
 1522 |         char phases[256][9];
      |              ^~~~~~
module/powerflow/solver_py.cpp:1595:157: warning: the address of 'phases' will never be NULL [-Waddress]
 1595 |                         m,b->name?b->name:"",bustype[b->type]?bustype[b->type]:bustypeerr,phases[b->phases]?phases[b->phases]:phaseserr,phases[b->origphases]?phases[b->origphases]:origphaseserr,*(b->busflag)<sizeof(busflag)/sizeof(busflag[0])?busflag[*(b->busflag)]:busflagerr,
      |                                                                                                                                         ~~~~~~~~~~~~~~~~~~~~^
module/powerflow/solver_py.cpp:1522:14: note: 'phases' declared here
 1522 |         char phases[256][9];
      |              ^~~~~~
module/powerflow/solver_py.cpp:1641:40: warning: the address of 'phases' will never be NULL [-Waddress]
 1641 |                 if ( phases[b->phases] == NULL ) snprintf(phaseserr,sizeof(phaseserr)-1,"ERROR:%d",(int)b->phases);
      |                                        ^
module/powerflow/solver_py.cpp:1522:14: note: 'phases' declared here
 1522 |         char phases[256][9];
      |              ^~~~~~
module/powerflow/solver_py.cpp:1642:44: warning: the address of 'phases' will never be NULL [-Waddress]
 1642 |                 if ( phases[b->origphases] == NULL ) snprintf(origphaseserr,sizeof(origphaseserr)-1,"ERROR:%d",(int)b->origphases);
      |                                            ^
module/powerflow/solver_py.cpp:1522:14: note: 'phases' declared here
 1522 |         char phases[256][9];
      |              ^~~~~~
module/powerflow/solver_py.cpp:1643:45: warning: the address of 'phases' will never be NULL [-Waddress]
 1643 |                 if ( phases[b->faultphases] == NULL ) snprintf(faultphaseserr,sizeof(faultphaseserr)-1,"ERROR:%d",(int)b->faultphases);
      |                                             ^
module/powerflow/solver_py.cpp:1522:14: note: 'phases' declared here
 1522 |         char phases[256][9];
      |              ^~~~~~
module/powerflow/solver_py.cpp:1650:73: warning: the address of 'phases' will never be NULL [-Waddress]
 1650 |                         n,b->name?b->name:"",branchtype,phases[b->phases]?phases[b->phases]:phaseserr,phases[b->origphases]?phases[b->origphases]:origphaseserr,phases[b->faultphases]?phases[b->faultphases]:faultphaseserr,b->from,b->to,b->fault_link_below?"FALSE":"TRUE",b->v_ratio,b->v_ratio,
      |                                                         ~~~~~~~~~~~~~~~~^
module/powerflow/solver_py.cpp:1522:14: note: 'phases' declared here
 1522 |         char phases[256][9];
      |              ^~~~~~
module/powerflow/solver_py.cpp:1650:123: warning: the address of 'phases' will never be NULL [-Waddress]
 1650 |                         n,b->name?b->name:"",branchtype,phases[b->phases]?phases[b->phases]:phaseserr,phases[b->origphases]?phases[b->origphases]:origphaseserr,phases[b->faultphases]?phases[b->faultphases]:faultphaseserr,b->from,b->to,b->fault_link_below?"FALSE":"TRUE",b->v_ratio,b->v_ratio,
      |                                                                                                       ~~~~~~~~~~~~~~~~~~~~^
module/powerflow/solver_py.cpp:1522:14: note: 'phases' declared here
 1522 |         char phases[256][9];
      |              ^~~~~~
module/powerflow/solver_py.cpp:1650:182: warning: the address of 'phases' will never be NULL [-Waddress]
 1650 |                         n,b->name?b->name:"",branchtype,phases[b->phases]?phases[b->phases]:phaseserr,phases[b->origphases]?phases[b->origphases]:origphaseserr,phases[b->faultphases]?phases[b->faultphases]:faultphaseserr,b->from,b->to,b->fault_link_below?"FALSE":"TRUE",b->v_ratio,b->v_ratio,
      |                                                                                                                                                                 ~~~~~~~~~~~~~~~~~~~~~^
module/powerflow/solver_py.cpp:1522:14: note: 'phases' declared here
 1522 |         char phases[256][9];
      |              ^~~~~~
In file included from module/powerflow/powerflow.h:13,
                 from module/powerflow/switch_object.cpp:12:
In member function 'void gld_string::copy(const char*)',
    inlined from 'gld_string& gld_string::operator=(const char*)' at ./source/gridlabd.h:1780:52,
    inlined from 'gld_string gld_global::get_string(size_t)' at ./source/gridlabd.h:3448:10:
./source/gridlabd.h:1816:53: warning: 'buf' may be used uninitialized [-Wmaybe-uninitialized]
 1816 |         inline void copy(const char *s) { fit(strlen(s)+1); strcpy(buf->str,s); };
      |                                               ~~~~~~^~~
In file included from /usr/include/memory.h:29,
                 from ./source/gridlabd.h:100:
/usr/include/string.h: In member function 'gld_string gld_global::get_string(size_t)':
/usr/include/string.h:407:15: note: by argument 1 of type 'const char*' to 'size_t strlen(const char*)' declared here
  407 | extern size_t strlen (const char *__s)
      |               ^~~~~~
./source/gridlabd.h:3445:22: note: 'buf' declared here
 3445 |                 char buf[1024];
      |                      ^~~
module/residential/refrigerator.cpp: In member function 'int refrigerator::init(OBJECT*)':
module/residential/refrigerator.cpp:247:26: warning: array subscript 3 is outside array bounds of 'void [24]' [-Warray-bounds=]
  247 |         ice_making_time[3] = 3.0;
      |         ~~~~~~~~~~~~~~~~~^
module/residential/refrigerator.cpp:244:39: note: at offset 24 into object of size 24 allocated by 'operator new []'
  244 |         ice_making_time = new double[3];
      |                                       ^
@dchassin dchassin added the bug Something isn't working label Sep 27, 2024
@dchassin dchassin self-assigned this Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Issues
Development

No branches or pull requests

1 participant