OPENDAP/libdap4

error: 'uint32_t' does not name a type when compiling Vector.cc with gcc 13

sharkcz opened this issue · 2 comments

I believe gcc 13 is stricter again (or changed its header structure) and a build on Fedora 38 on x86_64 (and others) using gcc-13.1.1-2.fc38.x86_64 now fails with

...
/bin/sh ./libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I.  -I./gl -I./gl -I./GNU -I/usr/include/libxml2  -I/usr/include/tirpc   --std=c++14 -Wall -W -Wcast-align -Wno-deprecated-register -Wno-inconsistent-missing-override  -g -O2 -DNDEBUG   -c -o libdap_la-Vector.lo `test -f 'Vector.cc' || echo './'`Vector.cc
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I./gl -I./gl -I./GNU -I/usr/include/libxml2 -I/usr/include/tirpc --std=c++14 -Wall -W -Wcast-align -Wno-deprecated-register -Wno-inconsistent-missing-override -g -O2 -DNDEBUG -c Vector.cc  -fPIC -DPIC -o .libs/libdap_la-Vector.o
In file included from Vector.cc:46:
crc.h:9:14: error: 'uint32_t' does not name a type
    9 | static const uint32_t kCrc32Table[256] = {
      |              ^~~~~~~~
crc.h:1:1: note: 'uint32_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
  +++ |+#include <cstdint>
    1 | /*
crc.h:79:13: error: 'uint32_t' does not name a type
   79 |     typedef uint32_t checksum;
      |             ^~~~~~~~
crc.h:79:13: note: 'uint32_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
crc.h:98:24: error: 'uint8_t' does not name a type
   98 |     void AddData(const uint8_t* pData, const uint32_t length)
      |                        ^~~~~~~
crc.h:98:24: note: 'uint8_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
crc.h:98:46: error: 'uint32_t' does not name a type
   98 |     void AddData(const uint8_t* pData, const uint32_t length)
      |                                              ^~~~~~~~
crc.h:98:46: note: 'uint32_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
crc.h:110:5: error: 'checksum' does not name a type
  110 |     checksum GetCrc32() const { return ~_crc; }
      |     ^~~~~~~~
crc.h:113:5: error: 'uint32_t' does not name a type
  113 |     uint32_t _crc;
      |     ^~~~~~~~
crc.h:113:5: note: 'uint32_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
crc.h: In member function 'void Crc32::Reset()':
crc.h:92:20: error: '_crc' was not declared in this scope
   92 |     void Reset() { _crc = (uint32_t)~0; }
      |                    ^~~~
crc.h:92:28: error: 'uint32_t' was not declared in this scope
   92 |     void Reset() { _crc = (uint32_t)~0; }
      |                            ^~~~~~~~
crc.h:92:28: note: 'uint32_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
crc.h: In member function 'void Crc32::AddData(const int*, int)':
crc.h:100:9: error: 'uint8_t' was not declared in this scope
  100 |         uint8_t* pCur = (uint8_t*)pData;
      |         ^~~~~~~
crc.h:100:9: note: 'uint8_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
crc.h:100:18: error: 'pCur' was not declared in this scope
  100 |         uint8_t* pCur = (uint8_t*)pData;
      |                  ^~~~
crc.h:100:34: error: expected primary-expression before ')' token
  100 |         uint8_t* pCur = (uint8_t*)pData;
      |                                  ^
crc.h:101:9: error: 'uint32_t' was not declared in this scope
  101 |         uint32_t remaining = length;
      |         ^~~~~~~~
crc.h:101:9: note: 'uint32_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
crc.h:102:16: error: 'remaining' was not declared in this scope
  102 |         for (; remaining--; ++pCur)
      |                ^~~~~~~~~
crc.h:103:13: error: '_crc' was not declared in this scope
  103 |             _crc = ( _crc >> 8 ) ^ kCrc32Table[(_crc ^ *pCur) & 0xff];
      |             ^~~~
crc.h:103:36: error: 'kCrc32Table' was not declared in this scope
  103 |             _crc = ( _crc >> 8 ) ^ kCrc32Table[(_crc ^ *pCur) & 0xff];
      |                                    ^~~~~~~~~~~
crc.h:98:33: warning: unused parameter 'pData' [-Wunused-parameter]
   98 |     void AddData(const uint8_t* pData, const uint32_t length)
      |                  ~~~~~~~~~~~~~~~^~~~~
crc.h:98:55: warning: unused parameter 'length' [-Wunused-parameter]
   98 |     void AddData(const uint8_t* pData, const uint32_t length)
      |                                        ~~~~~~~~~~~~~~~^~~~~~
In file included from Vector.cc:53:
D4StreamUnMarshaller.h: At global scope:
D4StreamUnMarshaller.h:107:12: error: 'checksum' in 'class Crc32' does not name a type
  107 |     Crc32::checksum get_checksum();
      |            ^~~~~~~~
Vector.cc: In member function 'virtual void libdap::Vector::compute_checksum(Crc32&)':
Vector.cc:978:34: error: cannot convert 'uint8_t*' {aka 'unsigned char*'} to 'const int*'
  978 |                 checksum.AddData(reinterpret_cast<uint8_t*>(d_buf), length_ll() * d_proto->width_ll());
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                  |
      |                                  uint8_t* {aka unsigned char*}
crc.h:98:33: note:   initializing argument 1 of 'void Crc32::AddData(const int*, int)'
   98 |     void AddData(const uint8_t* pData, const uint32_t length)
      |                  ~~~~~~~~~~~~~~~^~~~~
Vector.cc:984:42: error: cannot convert 'const uint8_t*' {aka 'const unsigned char*'} to 'const int*'
  984 |                         checksum.AddData(reinterpret_cast<const uint8_t*>(d_str[i].data()), d_str[i].size());
      |                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                          |
      |                                          const uint8_t* {aka const unsigned char*}
crc.h:98:33: note:   initializing argument 1 of 'void Crc32::AddData(const int*, int)'
   98 |     void AddData(const uint8_t* pData, const uint32_t length)
      |                  ~~~~~~~~~~~~~~~^~~~~
At global scope:
cc1plus: note: unrecognized command-line option '-Wno-inconsistent-missing-override' may have been intended to silence earlier diagnostics
cc1plus: note: unrecognized command-line option '-Wno-deprecated-register' may have been intended to silence earlier diagnostics
make[2]: *** [Makefile:1851: libdap_la-Vector.lo] Error 1

It is in <cstdint> as usually for C++ code, but seems the header isn't included any more thru some other headers.