We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
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:
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.
Fix is easy. #define should be rewritten. I will soon submit a pull request.
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
Different compilers will produce inconsistent results with lzf.cpp
The text was updated successfully, but these errors were encountered:
Modify STRICT_ALIGN because macro expansion w/defined is undefined
d9a79f7
Modify STRICT_ALIGN because macro expansion producing 'defined' has undefined behavior. closes PointCloudLibrary#2042 Signed-off-by: Kevin Dalley <[email protected]>
90aba59
No branches or pull requests
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: