seeing-things / zwo

ZWO SDK and custom software for debugging and using it.
23 stars 4 forks source link

Compiler warnings #61

Closed bgottula closed 3 years ago

bgottula commented 3 years ago

I see the following compiler warnings when running make for capture on Mint 20.1. I don't recall seeing compiler warnings on Mint 19.3.

(venv) rgottula@nix:~/dev/zwo/capture$ make
make -C ../zwo_fixer all
make[1]: Entering directory '/home/rgottula/dev/zwo/zwo_fixer'
g++ -std=c++17 -fno-exceptions -fno-strict-aliasing -D_GLIBCXX_USE_CXX11_ABI=0 -fdiagnostics-color=always -Wall -Wno-unused-variable -Wno-unused-function -O1 -fuse-linker-plugin -fvisibility=hidden -fvisibility-inlines-hidden -g3 -gdwarf-4 -fvar-tracking-assignments -fno-omit-frame-pointer -fuse-ld=gold -shared -fPIC -fno-plt -fno-gnu-unique -rdynamic -Wl,--no-gc-sections -Wl,--no-undefined -Wl,-z,defs -lbsd -ldl -lelf -lusb-1.0 -o libzwo_fixer.so zwo_fixer.cpp
make[1]: Leaving directory '/home/rgottula/dev/zwo/zwo_fixer'
mkdir -p bin
g++ src/Frame.cpp src/SERFile.cpp src/agc.cpp src/disk.cpp src/preview.cpp src/camera.cpp src/capture.cpp -o bin/capture -std=c++17 -Wall -g -D_LIN -D_GNU_SOURCE -I./include -pthread -DGLIBC_20 -O3 -m64 -lrt -lopencv_core -lopencv_highgui -lopencv_imgproc -I/usr/include/opencv4 -I../1.16.3/linux_sdk/include -L../1.16.3/linux_sdk/lib/x64 -l:libASICamera2.so.1.16.3 -I../zwo_fixer -Wl,-rpath,../zwo_fixer -Wl,-rpath,/home/rgottula/dev/zwo/zwo_fixer -L../zwo_fixer -l:libzwo_fixer.so
src/SERFile.cpp: In constructor ‘SERFile::SERFile(const char*, int32_t, int32_t, SERColorID_t, int32_t, const char*, const char*, const char*, bool)’:
src/SERFile.cpp:77:20: warning: taking address of packed member of ‘SERHeader_t’ may result in an unaligned pointer value [-Waddress-of-packed-member]
   77 |     makeTimestamps(&(header_->DateTime_UTC), &(header_->DateTime));
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~
src/SERFile.cpp:77:46: warning: taking address of packed member of ‘SERHeader_t’ may result in an unaligned pointer value [-Waddress-of-packed-member]
   77 |     makeTimestamps(&(header_->DateTime_UTC), &(header_->DateTime));
      |                                              ^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/string.h:495,
                 from /usr/include/c++/9/cstring:42,
                 from src/SERFile.cpp:2:
In function ‘char* strncpy(char*, const char*, size_t)’,
    inlined from ‘SERFile::SERFile(const char*, int32_t, int32_t, SERColorID_t, int32_t, const char*, const char*, const char*, bool)’ at src/SERFile.cpp:74:12:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:34: warning: ‘char* __builtin_strncpy(char*, const char*, long unsigned int)’ specified bound 40 equals destination size [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘char* strncpy(char*, const char*, size_t)’,
    inlined from ‘SERFile::SERFile(const char*, int32_t, int32_t, SERColorID_t, int32_t, const char*, const char*, const char*, bool)’ at src/SERFile.cpp:75:12:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:34: warning: ‘char* __builtin_strncpy(char*, const char*, long unsigned int)’ specified bound 40 equals destination size [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘char* strncpy(char*, const char*, size_t)’,
    inlined from ‘SERFile::SERFile(const char*, int32_t, int32_t, SERColorID_t, int32_t, const char*, const char*, const char*, bool)’ at src/SERFile.cpp:76:12:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:34: warning: ‘char* __builtin_strncpy(char*, const char*, long unsigned int)’ specified bound 40 equals destination size [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mkdir -p bin
g++ write_benchmark.cpp -o bin/write_benchmark -std=c++17 -Wall -g -D_LIN -D_GNU_SOURCE -I./include -pthread -DGLIBC_20 -O3 -m64 -lrt
jgottula commented 3 years ago

Newer Mint has newer GCC, and newer GCC tends to come with more and better warnings.