Got "-Wreserved-identifier" compiler warning when compiling with Clang-13.0.1
k-ye opened this issue · 4 comments
Describe the issue
Hi, we encountered this problem when installing tinyexr via vcpkg
, but I believe this is related to the compiler rather than the deps management system.
To Reproduce
Simply build tinyexr
with clang-13.0.1
. I'm on Ubuntu 20.04.4 LTS
. Tested with clang-12
and it built alright.
Here's the error log:
[1/3] /usr/local/bin/c++ -I/home/yekuang/Github/taco/third_party/vcpkg/buildtrees/tinyexr/src/v1.0.0-aa9dbdfb61.clean -fPIC -g -std=c++11 -Weverything -Werror -Wno-padded -Wno-c++98-compat-pedantic -Wno-documentation -Wno-unused-member-function -MD -MT CMakeFiles/tinyexr.dir/tinyexr.cc.o -MF CMakeFiles/tinyexr.dir/tinyexr.cc.o.d -o CMakeFiles/tinyexr.dir/tinyexr.cc.o -c /home/yekuang/Github/taco/third_party/vcpkg/buildtrees/tinyexr/src/v1.0.0-aa9dbdfb61.clean/tinyexr.cc
FAILED: CMakeFiles/tinyexr.dir/tinyexr.cc.o
/usr/local/bin/c++ -I/home/yekuang/Github/taco/third_party/vcpkg/buildtrees/tinyexr/src/v1.0.0-aa9dbdfb61.clean -fPIC -g -std=c++11 -Weverything -Werror -Wno-padded -Wno-c++98-compat-pedantic -Wno-documentation -Wno-unused-member-function -MD -MT CMakeFiles/tinyexr.dir/tinyexr.cc.o -MF CMakeFiles/tinyexr.dir/tinyexr.cc.o.d -o CMakeFiles/tinyexr.dir/tinyexr.cc.o -c /home/yekuang/Github/taco/third_party/vcpkg/buildtrees/tinyexr/src/v1.0.0-aa9dbdfb61.clean/tinyexr.cc
In file included from /home/yekuang/Github/taco/third_party/vcpkg/buildtrees/tinyexr/src/v1.0.0-aa9dbdfb61.clean/tinyexr.cc:8:
/home/yekuang/Github/taco/third_party/vcpkg/buildtrees/tinyexr/src/v1.0.0-aa9dbdfb61.clean/tinyexr.h:163:16: error: identifier '_EXRVersion' is reserved because it starts with '_' followed by a capital letter [-Werror,-Wreserved-identifier]
typedef struct _EXRVersion {
^
/home/yekuang/Github/taco/third_party/vcpkg/buildtrees/tinyexr/src/v1.0.0-aa9dbdfb61.clean/tinyexr.h:171:16: error: identifier '_EXRAttribute' is reserved because it starts with '_' followed by a capital letter [-Werror,-Wreserved-identifier]
typedef struct _EXRAttribute {
^
/home/yekuang/Github/taco/third_party/vcpkg/buildtrees/tinyexr/src/v1.0.0-aa9dbdfb61.clean/tinyexr.h:179:16: error: identifier '_EXRChannelInfo' is reserved because it starts with '_' followed by a capital letter [-Werror,-Wreserved-identifier]
typedef struct _EXRChannelInfo {
^
/home/yekuang/Github/taco/third_party/vcpkg/buildtrees/tinyexr/src/v1.0.0-aa9dbdfb61.clean/tinyexr.h:188:16: error: identifier '_EXRTile' is reserved because it starts with '_' followed by a capital letter [-Werror,-Wreserved-identifier]
typedef struct _EXRTile {
^
/home/yekuang/Github/taco/third_party/vcpkg/buildtrees/tinyexr/src/v1.0.0-aa9dbdfb61.clean/tinyexr.h:200:16: error: identifier '_EXRBox2i' is reserved because it starts with '_' followed by a capital letter [-Werror,-Wreserved-identifier]
typedef struct _EXRBox2i {
^
/home/yekuang/Github/taco/third_party/vcpkg/buildtrees/tinyexr/src/v1.0.0-aa9dbdfb61.clean/tinyexr.h:207:16: error: identifier '_EXRHeader' is reserved because it starts with '_' followed by a capital letter [-Werror,-Wreserved-identifier]
typedef struct _EXRHeader {
^
/home/yekuang/Github/taco/third_party/vcpkg/buildtrees/tinyexr/src/v1.0.0-aa9dbdfb61.clean/tinyexr.h:250:16: error: identifier '_EXRMultiPartHeader' is reserved because it starts with '_' followed by a capital letter [-Werror,-Wreserved-identifier]
typedef struct _EXRMultiPartHeader {
^
/home/yekuang/Github/taco/third_party/vcpkg/buildtrees/tinyexr/src/v1.0.0-aa9dbdfb61.clean/tinyexr.h:256:16: error: identifier '_EXRImage' is reserved because it starts with '_' followed by a capital letter [-Werror,-Wreserved-identifier]
typedef struct _EXRImage {
^
/home/yekuang/Github/taco/third_party/vcpkg/buildtrees/tinyexr/src/v1.0.0-aa9dbdfb61.clean/tinyexr.h:270:16: error: identifier '_EXRMultiPartImage' is reserved because it starts with '_' followed by a capital letter [-Werror,-Wreserved-identifier]
typedef struct _EXRMultiPartImage {
^
/home/yekuang/Github/taco/third_party/vcpkg/buildtrees/tinyexr/src/v1.0.0-aa9dbdfb61.clean/tinyexr.h:276:16: error: identifier '_DeepImage' is reserved because it starts with '_' followed by a capital letter [-Werror,-Wreserved-identifier]
typedef struct _DeepImage {
^
10 errors generated.
Happy to submit a PR around
Line 46 in 5c68638
Please attach minimal and reproducible files(source codes, EXR files, etc)
Expected behavior
A clear and concise description of what you expected to happen.
Environment
- OS: Ubuntu 20.04.4 LTS
- Compiler Clang-13.0.1
Yeah! PR of suppressing clang warnings is nice, but it'd be better to rewrite typedef struct ...
syntax. This is to support old pre-C++11 compiler(C++98, C++03), but C++11 is now widely supported in most of C++ compilers so its we are better to deprecate compiling TinyEXR with pre-C++11 compiler(PR of this typedef struct
rewrite is also much appreciated)
it'd be better to rewrite typedef struct ... syntax
Thanks! I'm assuming that typedef struct ...
itself is all right. What the error is really about is that "identifier '_EXRVersion' is reserved because it starts with '_' followed by a capital letter [-Werror,-Wreserved-identifier]"
. So maybe renaming _EXRVersion
to EXRVersion
could solve the problem :-) ?
Oh I already did a fix in recent release
Line 184 in 5c68638
You should use recent tinyexr.h from the repo. vcpkg
is maintained someone and I don't know.
Great, thank you for the help!