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

Csaba Raduly via llvm-dev llvm-dev at lists.llvm.org
Thu Jun 8 03:50:20 PDT 2017


~/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


More information about the llvm-dev mailing list