[llvm-dev] Non-standard C++ usage

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[llvm-dev] Non-standard C++ usage

Gerion Entrup via llvm-dev
~/workspace/LLVM/llvm/projects/compiler-rt/lib/tsan/rtl/tsan_report.cc:
In function ‘const char* __tsan::ReportTypeString(__tsan::ReportType,
__sanitizer::uptr)’:
~/workspace/LLVM/llvm/projects/compiler-rt/lib/tsan/rtl/tsan_report.cc:95:41:
warning: ISO C++ does not allow ?: with omitted middle operand
[-Wpedantic]
     return GetReportHeaderFromTag(tag) ?: "race on external object";
                                         ^
~/workspace/LLVM/llvm/projects/compiler-rt/lib/tsan/rtl/tsan_report.cc:95:43:
warning: ISO C++ forbids omitting the middle term of a ?: expression
[-Wpedantic]
     return GetReportHeaderFromTag(tag) ?: "race on external object";
                                           ^
~/workspace/LLVM/llvm/projects/compiler-rt/lib/tsan/rtl/tsan_report.cc:
In function ‘void __tsan::PrintMop(const __tsan::ReportMop*, bool)’:
~/workspace/LLVM/llvm/projects/compiler-rt/lib/tsan/rtl/tsan_report.cc:174:50:
warning: ISO C++ does not allow ?: with omitted middle operand
[-Wpedantic]
         GetObjectTypeFromTag(mop->external_tag) ?: "external object";
                                                  ^
~/workspace/LLVM/llvm/projects/compiler-rt/lib/tsan/rtl/tsan_report.cc:174:52:
warning: ISO C++ forbids omitting the middle term of a ?: expression
[-Wpedantic]
         GetObjectTypeFromTag(mop->external_tag) ?: "external object";

This usage is a GCC extension and is likely not portable to other
compilers (even if clang also accepts it).

Csaba
--
GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
The Tao of math: The numbers you can count are not the real numbers.
Life is complex, with real and imaginary parts.
"Ok, it boots. Which means it must be bug-free and perfect. " -- Linus Torvalds
"People disagree with me. I just ignore them." -- Linus Torvalds
_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] Non-standard C++ usage

Gerion Entrup via llvm-dev
I'm guessing LLVM doesn't build by default with -Wpedantic - and you added that to your compiler flags for your build?

While I wouldn't be averse to these being fixed, it might not be a high priority for anyone if this sort of thing works on all the supported compilers, I'm not sure. (maybe CC the people who last touched/wrote the code to bring this to their attention - sometimes not everyone catches everything on the mailing lists)

On Thu, Jun 8, 2017 at 3:50 AM Csaba Raduly via llvm-dev <[hidden email]> wrote:
~/workspace/LLVM/llvm/projects/compiler-rt/lib/tsan/rtl/tsan_report.cc:
In function ‘const char* __tsan::ReportTypeString(__tsan::ReportType,
__sanitizer::uptr)’:
~/workspace/LLVM/llvm/projects/compiler-rt/lib/tsan/rtl/tsan_report.cc:95:41:
warning: ISO C++ does not allow ?: with omitted middle operand
[-Wpedantic]
     return GetReportHeaderFromTag(tag) ?: "race on external object";
                                         ^
~/workspace/LLVM/llvm/projects/compiler-rt/lib/tsan/rtl/tsan_report.cc:95:43:
warning: ISO C++ forbids omitting the middle term of a ?: expression
[-Wpedantic]
     return GetReportHeaderFromTag(tag) ?: "race on external object";
                                           ^
~/workspace/LLVM/llvm/projects/compiler-rt/lib/tsan/rtl/tsan_report.cc:
In function ‘void __tsan::PrintMop(const __tsan::ReportMop*, bool)’:
~/workspace/LLVM/llvm/projects/compiler-rt/lib/tsan/rtl/tsan_report.cc:174:50:
warning: ISO C++ does not allow ?: with omitted middle operand
[-Wpedantic]
         GetObjectTypeFromTag(mop->external_tag) ?: "external object";
                                                  ^
~/workspace/LLVM/llvm/projects/compiler-rt/lib/tsan/rtl/tsan_report.cc:174:52:
warning: ISO C++ forbids omitting the middle term of a ?: expression
[-Wpedantic]
         GetObjectTypeFromTag(mop->external_tag) ?: "external object";

This usage is a GCC extension and is likely not portable to other
compilers (even if clang also accepts it).

Csaba
--
GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
The Tao of math: The numbers you can count are not the real numbers.
Life is complex, with real and imaginary parts.
"Ok, it boots. Which means it must be bug-free and perfect. " -- Linus Torvalds
"People disagree with me. I just ignore them." -- Linus Torvalds
_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] Non-standard C++ usage

Gerion Entrup via llvm-dev
On Thu, Jun 08, 2017 at 04:46:50PM +0000, David Blaikie via llvm-dev wrote:
> While I wouldn't be averse to these being fixed, it might not be a high
> priority for anyone if this sort of thing works on all the supported
> compilers, I'm not sure. (maybe CC the people who last touched/wrote the
> code to bring this to their attention - sometimes not everyone catches
> everything on the mailing lists)

Since this is the sanitzer runtime, it doesn't matter that much right
now if it doesn't work on non-GCC non-Clang compilers.

Joerg
_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev