[llvm] r305143 - Added llvm_unreachable as ReportError cannot be specified as noreturn.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 12 13:15:47 PDT 2017


This example seems to work:

int f() {
  auto F = []() __attribute__((noreturn)) { abort(); };
  F();
}

Though in LLVM, the LLVM_ATTRIBUTE_NORETURN macro rather than
__attribute__((noreturn)). (it's possible that using an attribute in this
location isn't uniformly supported by all compilers LLVM supports (at least
those that support the attribute in other contexts (the macro expands to
nothing on platforms that don't support the attribute anywhere)) in which
case maybe just pulling the function out into a named file-local-static
function would be fine, and that can be attributed)

On Mon, Jun 12, 2017 at 12:11 PM Galina Kistanova <gkistanova at gmail.com>
wrote:

> Because ReportError is a lambda, and I do not think one could declare
> operator() of a lambda as noreturn on any standard way within c++11.
> What am I missing?
>
> Thanks
>
> Galina
>
>
>
> On Mon, Jun 12, 2017 at 9:53 AM, David Blaikie <dblaikie at gmail.com> wrote:
>
>> Why can't ReportError be noreturn?
>>
>> On Sat, Jun 10, 2017 at 12:50 AM Galina Kistanova via llvm-commits <
>> llvm-commits at lists.llvm.org> wrote:
>>
>>> Author: gkistanova
>>> Date: Sat Jun 10 02:50:14 2017
>>> New Revision: 305143
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=305143&view=rev
>>> Log:
>>> Added llvm_unreachable as ReportError cannot be specified as noreturn.
>>>
>>> Modified:
>>>     llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
>>>
>>> Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp?rev=305143&r1=305142&r2=305143&view=diff
>>>
>>> ==============================================================================
>>> --- llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp (original)
>>> +++ llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp Sat Jun 10
>>> 02:50:14 2017
>>> @@ -585,6 +585,7 @@ void DWARFDebugFrame::parse(DataExtracto
>>>            switch (AugmentationString[i]) {
>>>              default:
>>>                ReportError("Unknown augmentation character in entry at
>>> %lx");
>>> +              llvm_unreachable("ReportError should not return.");
>>>              case 'L':
>>>                LSDAPointerEncoding = Data.getU8(&Offset);
>>>                break;
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170612/ff157685/attachment.html>


More information about the llvm-commits mailing list