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

David Blaikie via llvm-dev llvm-dev at lists.llvm.org
Thu Jun 8 09:46:50 PDT 2017


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 <
llvm-dev at lists.llvm.org> 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
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170608/629a8c42/attachment.html>


More information about the llvm-dev mailing list