team-charls / charls

CharLS, a C++ JPEG-LS library implementation
BSD 3-Clause "New" or "Revised" License
188 stars 74 forks source link

Added <cstdint> for GCC #208

Closed Jamaika1 closed 1 year ago

vbaderks commented 1 year ago

Hi @Jamaika1,

On which version of GCC\libc++did you see this problem?

Jamaika1 commented 1 year ago

Test gcc 13.0.0 for c++17/20. Other GCCs don't have the latest patches. I'm surprised recently that gcc 11.3.0 doesn't need <cstdint>, <cmath> for C++17. Should these features be added automatically for C++17?

Using built-in specs.
COLLECT_GCC=g++.exe
Target: x86_64-w64-mingw32
Configured with: /home/ma/m/source/gcc-g/configure --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --disable-nls --enable-languages=c,c++,objc,obj-c++ --with-gmp=/home/ma/m/build/for_target --with-mpfr=/home/ma/m/build/for_target --with-mpc=/home/ma/m/build/for_target --with-isl=/home/ma/m/build/for_target --enable-twoprocess --disable-libstdcxx-pch --disable-win32-registry --disable-shared --enable-fully-dynamic-string --enable-libssp --prefix=/home/ma/m/target --with-sysroot=/home/ma/m/target
Thread model: win32
Supported LTO compression algorithms: zlib
gcc version 13.0.0 20221223 (experimental) (GCC)
COLLECT_GCC_OPTIONS='-v' '-std=gnu++17' '-ftree-vectorize' '-g0' '-O3' '-fPIC' '-D' 'WIN32' '-D' '_DEBUG' '-D' 'CHARLS_STATIC' '-c' '-o' 'performance.o' '-mtune=generic' '-march=x86-64'
 c:/gcc1300/bin/../libexec/gcc/x86_64-w64-mingw32/13.0.0/cc1plus.exe -quiet -v -iprefix c:\gcc1300\bin\../lib/gcc/x86_64-w64-mingw32/13.0.0/ -U_REENTRANT -D WIN32 -D _DEBUG -D CHARLS_STATIC performance.cpp -quiet -dumpbase performance.cpp -dumpbase-ext .cpp -mtune=generic -march=x86-64 -g0 -O3 -std=gnu++17 -version -ftree-vectorize -fPIC -o C:\Users\KOMPUT~1\AppData\Local\Temp\ccHeKGk6.s
GNU C++17 (GCC) version 13.0.0 20221223 (experimental) (x86_64-w64-mingw32)
        compiled by GNU C version 13.0.0 20221223 (experimental), GMP version 6.2.1, MPFR version 4.1.1, MPC version 1.2.1, isl version isl-0.24-GMP

GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
ignoring duplicate directory "c:/gcc1300/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/13.0.0/../../../../include/c++/13.0.0"
ignoring duplicate directory "c:/gcc1300/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/13.0.0/../../../../include/c++/13.0.0/x86_64-w64-mingw32"
ignoring duplicate directory "c:/gcc1300/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/13.0.0/../../../../include/c++/13.0.0/backward"
ignoring duplicate directory "c:/gcc1300/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/13.0.0/include"
ignoring nonexistent directory "/home/ma/m/target/home/ma/m/target/lib/gcc/x86_64-w64-mingw32/13.0.0/../../../../include"
ignoring duplicate directory "c:/gcc1300/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/13.0.0/include-fixed"
ignoring duplicate directory "c:/gcc1300/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/13.0.0/../../../../x86_64-w64-mingw32/include"
ignoring nonexistent directory "/home/ma/m/target/mingw/include"
#include "..." search starts here:
#include <...> search starts here:
 c:\gcc1300\bin\../lib/gcc/x86_64-w64-mingw32/13.0.0/../../../../include/c++/13.0.0
 c:\gcc1300\bin\../lib/gcc/x86_64-w64-mingw32/13.0.0/../../../../include/c++/13.0.0/x86_64-w64-mingw32
 c:\gcc1300\bin\../lib/gcc/x86_64-w64-mingw32/13.0.0/../../../../include/c++/13.0.0/backward
 c:\gcc1300\bin\../lib/gcc/x86_64-w64-mingw32/13.0.0/include
 c:\gcc1300\bin\../lib/gcc/x86_64-w64-mingw32/13.0.0/include-fixed
 c:\gcc1300\bin\../lib/gcc/x86_64-w64-mingw32/13.0.0/../../../../x86_64-w64-mingw32/include
End of search list.
GNU C++17 (GCC) version 13.0.0 20221223 (experimental) (x86_64-w64-mingw32)
        compiled by GNU C version 13.0.0 20221223 (experimental), GMP version 6.2.1, MPFR version 4.1.1, MPC version 1.2.1, isl version isl-0.24-GMP

GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 2b6c2fb9839dec486c0793745b5cdfdc
In file included from performance.cpp:6:
portable_anymap_file.h:80:17: error: 'uint8_t' was not declared in this scope
   80 |     std::vector<uint8_t>& image_data() noexcept
      |                 ^~~~~~~
portable_anymap_file.h:12:1: note: 'uint8_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
   11 | #include <vector>
  +++ |+#include <cstdint>
vbaderks commented 1 year ago

include was missing, but other C++ standard library headers were including it implicitly.

I have seen it in the past that newer C++ standard libraries have less implicit includes.