[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#833931: marked as done (c++: Fail to build when <stdnoreturn.h> and the noreturn keyword is used)



Your message dated Thu, 7 Feb 2019 10:37:16 +0100
with message-id <[🔎] 081ceef8-afd3-c797-3072-b62905cd500b@debian.org>
and subject line Re: Bug#833931: c++: Fail to build when <stdnoreturn.h> and the noreturn keyword is used
has caused the Debian Bug report #833931,
regarding c++: Fail to build when <stdnoreturn.h> and the noreturn keyword is used
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
833931: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=833931
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: g++-6
Version: 6.1.1-11

I ran into this issue while trying to prepare the coz profiler for
Debian.

The <stdnoreturn.h> header file seem to be inefficient when using cc and
clang, be ignored causing an build error when using c++.

I found this example code on
<URL: http://en.cppreference.com/w/c/language/_Noreturn >, and it fail
to build with c++, but build with both cc and clang:

% cat > y.c
#include <stdlib.h>
#include <stdio.h>
#include <stdnoreturn.h>
 
// causes undefined behavior if i <= 0
// exits if i > 0
noreturn void stop_now(int i) // or _Noreturn void stop_now(int i)
{
    if (i > 0) exit(i);
}
 
int main(void)
{
  puts("Preparing to stop...");
  stop_now(2);
  puts("This code is never executed.");
}
% gcc y.c 
y.c: In function 'stop_now':
y.c:10:1: warning: 'noreturn' function does return
 }
 ^
% ./a.out 
Preparing to stop...
% c++ y.c 
y.c:7:1: error: 'noreturn' does not name a type
 noreturn void stop_now(int i) // or _Noreturn void stop_now(int i)
 ^~~~~~~~
y.c: In function 'int main()':
y.c:15:13: error: 'stop_now' was not declared in this scope
   stop_now(2);
             ^
% clang y.c 
y.c:10:1: warning: function declared 'noreturn' should not return [-Winvalid-noreturn]
}
^
1 warning generated.
%

Perhaps something that should be fixed?

-- 
Happy hacking
Petter Reinholdtsen

--- End Message ---
--- Begin Message ---
On 07.02.19 08:07, Petter Reinholdtsen wrote:
> Control: forwarded -1 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89232
> 
> I registered the issue upstream.

closed as invalid.

--- End Message ---

Reply to: