You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Modify STRICT_ALIGN because macro expansion producing 'defined' has
undefined behavior.
closesPointCloudLibrary#2042
Signed-off-by: Kevin Dalley <kevin@kelphead.org>
Modify STRICT_ALIGN because macro expansion producing 'defined' has
undefined behavior.
closesPointCloudLibrary#2042
Signed-off-by: Kevin Dalley <kevin@kelphead.org>
Your Environment
Operating System and version: Ubuntu 17.10
Compiler: clang version 4.0.1-6 (tags/RELEASE_401/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
PCL Version: HEAD
I used the following cmake command:
Expected Behavior
No warning for below line, when compiling
Current Behavior
clang warnings point out a problem with io/src/lzf.cpp, used "defined"
as part of a macro expension has undefined results.
/home/kevin/src/pcl/io/src/lzf.cpp:58:6: error: macro expansion producing
'defined' has undefined behavior [-Werror,-Wexpansion-to-defined]
/home/kevin/src/pcl/io/src/lzf.cpp:57:43: note: expanded from macro
'STRICT_ALIGN'
#define STRICT_ALIGN !(defined(__i386) || defined (__amd64))
^
/home/kevin/src/pcl/io/src/lzf.cpp:137:5: error: macro expansion producing
'defined' has undefined behavior [-Werror,-Wexpansion-to-defined]
#if STRICT_ALIGN
^
/home/kevin/src/pcl/io/src/lzf.cpp:57:24: note: expanded from macro
'STRICT_ALIGN'
#define STRICT_ALIGN !(defined(__i386) || defined (__amd64))
^
/home/kevin/src/pcl/io/src/lzf.cpp:137:5: error: macro expansion producing
'defined' has undefined behavior [-Werror,-Wexpansion-to-defined]
/home/kevin/src/pcl/io/src/lzf.cpp:57:43: note: expanded from macro
'STRICT_ALIGN'
#define STRICT_ALIGN !(defined(__i386) || defined (__amd64))
^
4 errors generated.
Possible Solution
Fix is easy.
#define should be rewritten. I will soon submit a pull request.
Code to Reproduce
cmake .. -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/clang++ -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/clang -DCMAKE_CXX_FLAGS:STRING="-fno-omit-frame-pointer -Wno-overloaded-virtual -Wno-bind-to-temporary-copy -Wno-unused -Wno-conversion -Werror -Wno-error=dynamic-class-memaccess" -DCMAKE_C_FLAGS:STRING="-fno-omit-frame-pointer -Wno-overloaded-virtual -Wno-bind-to-temporary-copy -Wno-unused -Wno-conversion -Werror -Wno-error=dynamic-class-memaccess" -DBUILD_global_tests=ON
make
Context
Different compilers will produce inconsistent results with lzf.cpp
The text was updated successfully, but these errors were encountered: