Re: C1X _Noreturn

2011-08-24 Thread Richard Sandiford
Joseph S. Myers jos...@codesourcery.com writes:
 I didn't touch the USER_H definition in mips/t-sdemtk (so that target
 will not install this new header).  The comment Remove stdarg.h and
 stddef.h from USER_H. suggests that maybe it should be added to that
 definition, but stdfix.h is also missing from that definition.  As far
 as I know MIPS is no longer using the old SDE library and it is
 considered superseded by newlib, so perhaps that configuration
 (mips*-sde-elf* without newlib) should actually be deprecated/removed
 (and mipssde threads along with it).

BTW, do you know whether the same applies to -mno-float, which at the
moment is specific to sdemtk?  That option was never really implemented,
and just relied on the user being very, very careful.  It would be nice
to deprecate it at the same time.

If so, I'll do a patch this weekend to deprecate all three (the thread
model, the option, and the configuration).

Richard


Re: C1X _Noreturn

2011-08-24 Thread Joseph S. Myers
On Wed, 24 Aug 2011, Richard Sandiford wrote:

 Joseph S. Myers jos...@codesourcery.com writes:
  I didn't touch the USER_H definition in mips/t-sdemtk (so that target
  will not install this new header).  The comment Remove stdarg.h and
  stddef.h from USER_H. suggests that maybe it should be added to that
  definition, but stdfix.h is also missing from that definition.  As far
  as I know MIPS is no longer using the old SDE library and it is
  considered superseded by newlib, so perhaps that configuration
  (mips*-sde-elf* without newlib) should actually be deprecated/removed
  (and mipssde threads along with it).
 
 BTW, do you know whether the same applies to -mno-float, which at the
 moment is specific to sdemtk?  That option was never really implemented,
 and just relied on the user being very, very careful.  It would be nice
 to deprecate it at the same time.

I don't know - Catherine, do you know if MIPS has ceased to use -mno-float 
along with replacing the SDE library with newlib?

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: C1X _Noreturn

2011-08-24 Thread Paolo Bonzini

On 08/18/2011 11:37 PM, Joseph S. Myers wrote:

C1X provides a standard way of declaring non-returning functions, with
the _Noreturn keyword and a header stdnoreturn.h defining a macro
noreturn to expand to _Noreturn.  This patch implements this syntax
and header.  Bootstrapped with no regressions on
x86_64-unknown-linux-gnu.  Applied to mainline.

I didn't touch the USER_H definition in mips/t-sdemtk (so that target
will not install this new header).  The comment Remove stdarg.h and
stddef.h from USER_H. suggests that maybe it should be added to that
definition, but stdfix.h is also missing from that definition.  As far
as I know MIPS is no longer using the old SDE library and it is
considered superseded by newlib, so perhaps that configuration
(mips*-sde-elf* without newlib) should actually be deprecated/removed
(and mipssde threads along with it).

The new keyword is C-only (C++0x has a different way of declaring
non-returning functions) and I did not try to make the header do
anything useful if included in C++ code.

2011-08-18  Joseph Myersjos...@codesourcery.com

* c-decl.c (shadow_tag_warned): Check for _Noreturn.
(quals_from_declspecs): Assert _Noreturn not present.
(grokdeclarator): Handle _Noreturn.
(build_null_declspecs): Initialize noreturn_p.
(declspecs_add_scspec): Handle RID_NORETURN.
* c-parser.c (c_token_starts_declspecs, c_parser_declspecs)
(c_parser_attributes): Handle RID_NORETURN.
* c-tree.h (struct c_declspecs): Add noreturn_p.
* ginclude/stdnoreturn.h: New.
* Makefile.in (USER_H): Add stdnoreturn.h.

c-family:
2011-08-18  Joseph Myersjos...@codesourcery.com

* c-common.c (c_common_reswords): Add _Noreturn.
(keyword_is_function_specifier): Handle RID_NORETURN.
* c-common.h (RID_NORETURN): New.

testsuite:
2011-08-18  Joseph Myersjos...@codesourcery.com

* gcc.dg/c1x-noreturn-1.c, gcc.dg/c1x-noreturn-2.c,
gcc.dg/c1x-noreturn-3.c, gcc.dg/c1x-noreturn-4.c,
gcc.dg/c1x-noreturn-5.c: New tests.


Would it make any sense to accept _Noreturn as an alternative spelling 
for the __noreturn__ attribute, in case someone is using the 
non-underscore-wrapped variant?


Thanks,

Paolo


Re: C1X _Noreturn

2011-08-24 Thread Catherine Moore

On 08/24/2011 07:24 AM, Joseph S. Myers wrote:

On Wed, 24 Aug 2011, Richard Sandiford wrote:


Joseph S. Myersjos...@codesourcery.com  writes:

I didn't touch the USER_H definition in mips/t-sdemtk (so that target
will not install this new header).  The comment Remove stdarg.h and
stddef.h from USER_H. suggests that maybe it should be added to that
definition, but stdfix.h is also missing from that definition.  As far
as I know MIPS is no longer using the old SDE library and it is
considered superseded by newlib, so perhaps that configuration
(mips*-sde-elf* without newlib) should actually be deprecated/removed
(and mipssde threads along with it).


BTW, do you know whether the same applies to -mno-float, which at the
moment is specific to sdemtk?  That option was never really implemented,
and just relied on the user being very, very careful.  It would be nice
to deprecate it at the same time.


I don't know - Catherine, do you know if MIPS has ceased to use -mno-float
along with replacing the SDE library with newlib?



MIPS continues to use the -mno-float option.  That should not be 
dperecated.  As Joseph points out, the configuration for mips-sde-elf* 
without newlib is no longer in use and may be deprecated.


Catherine


Re: C1X _Noreturn

2011-08-24 Thread Joseph S. Myers
On Wed, 24 Aug 2011, Paolo Bonzini wrote:

 Would it make any sense to accept _Noreturn as an alternative spelling for the
 __noreturn__ attribute, in case someone is using the non-underscore-wrapped
 variant?

I suppose it might help some people use stdnoreturn.h, though I'm not 
really sure stdnoreturn.h is that useful.

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: C1X _Noreturn

2011-08-19 Thread Richard Sandiford
Joseph S. Myers jos...@codesourcery.com writes:
 As far as I know MIPS is no longer using the old SDE library and it is
 considered superseded by newlib,

Hadn't realised that.

 so perhaps that configuration (mips*-sde-elf* without newlib) should
 actually be deprecated/removed (and mipssde threads along with it).

Yeah, sounds like a good plan.

Richard


Re: C1X _Noreturn

2011-08-19 Thread Joseph S. Myers
On Thu, 18 Aug 2011, Gabriel Dos Reis wrote:

 On Thu, Aug 18, 2011 at 4:37 PM, Joseph S. Myers
 jos...@codesourcery.com wrote:
 
  The new keyword is C-only (C++0x has a different way of declaring
  non-returning functions) and I did not try to make the header do
  anything useful if included in C++ code.
 
 I would suggest you don't define it all as macro when __cplusplus is defined.

This followup patch:

* stops stdnoreturn.h from defining the noreturn macro for C++, as
  suggested;

* adds a pedwarn-if-pedantic for using _Noreturn outside C1X mode (not
  formally required as it's in the reserved namespace, but still seems
  useful and is similar to what's done with _Complex, for example);

* mentions _Noreturn in the syntax comments in the C parser.

Bootstrapped with no regressions on x86_64-unknown-linux-gnu.  Applied
to mainline.

2011-08-19  Joseph Myers  jos...@codesourcery.com

* c-decl.c (grokdeclarator): Diagnose _Noreturn for non-C1X if
pedantic.
* c-parser.c (c_parser_declspecs): Include _Noreturn in syntax
comment.
* ginclude/stdnoreturn.h (noreturn): Don't define for C++.

testsuite:
2011-08-19  Joseph Myers  jos...@codesourcery.com

* gcc.dg/c90-noreturn-1.c, gcc.dg/c99-noreturn-1.c: New tests.

Index: gcc/ginclude/stdnoreturn.h
===
--- gcc/ginclude/stdnoreturn.h  (revision 177894)
+++ gcc/ginclude/stdnoreturn.h  (working copy)
@@ -26,6 +26,10 @@ see the files COPYING3 and COPYING.RUNTI
 #ifndef _STDNORETURN_H
 #define _STDNORETURN_H
 
+#ifndef __cplusplus
+
 #define noreturn _Noreturn
 
+#endif
+
 #endif /* stdnoreturn.h */
Index: gcc/testsuite/gcc.dg/c99-noreturn-1.c
===
--- gcc/testsuite/gcc.dg/c99-noreturn-1.c   (revision 0)
+++ gcc/testsuite/gcc.dg/c99-noreturn-1.c   (revision 0)
@@ -0,0 +1,5 @@
+/* Test _Noreturn not in C99.  */
+/* { dg-do compile } */
+/* { dg-options -std=iso9899:1999 -pedantic-errors } */
+
+_Noreturn void f (void); /* { dg-error ISO C99 does not support '_Noreturn' 
} */
Index: gcc/testsuite/gcc.dg/c90-noreturn-1.c
===
--- gcc/testsuite/gcc.dg/c90-noreturn-1.c   (revision 0)
+++ gcc/testsuite/gcc.dg/c90-noreturn-1.c   (revision 0)
@@ -0,0 +1,5 @@
+/* Test _Noreturn not in C90.  */
+/* { dg-do compile } */
+/* { dg-options -std=iso9899:1990 -pedantic-errors } */
+
+_Noreturn void f (void); /* { dg-error ISO C90 does not support '_Noreturn' 
} */
Index: gcc/c-decl.c
===
--- gcc/c-decl.c(revision 177894)
+++ gcc/c-decl.c(working copy)
@@ -5986,7 +5986,18 @@ grokdeclarator (const struct c_declarato
  /* Record that the function is declared `inline'.  */
  DECL_DECLARED_INLINE_P (decl) = 1;
if (declspecs-noreturn_p)
- TREE_THIS_VOLATILE (decl) = 1;
+ {
+   if (!flag_isoc1x)
+ {
+   if (flag_isoc99)
+ pedwarn (loc, OPT_pedantic,
+  ISO C99 does not support %_Noreturn%);
+   else
+ pedwarn (loc, OPT_pedantic,
+  ISO C90 does not support %_Noreturn%);
+ }
+   TREE_THIS_VOLATILE (decl) = 1;
+ }
  }
   }
 else
Index: gcc/c-parser.c
===
--- gcc/c-parser.c  (revision 177894)
+++ gcc/c-parser.c  (working copy)
@@ -1905,6 +1905,9 @@ c_parser_static_assert_declaration_no_se
C99 6.7.4:
function-specifier:
  inline
+ _Noreturn
+
+   (_Noreturn is new in C1X.)
 
C90 6.5.2, C99 6.7.2:
type-specifier:

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: C1X _Noreturn

2011-08-19 Thread Rainer Orth
Richard Sandiford rdsandif...@googlemail.com writes:

 so perhaps that configuration (mips*-sde-elf* without newlib) should
 actually be deprecated/removed (and mipssde threads along with it).

 Yeah, sounds like a good plan.

Good to know :-)  Could have saved me a little bit of work with the
libgcc patches.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: C1X _Noreturn

2011-08-18 Thread Gabriel Dos Reis
On Thu, Aug 18, 2011 at 4:37 PM, Joseph S. Myers
jos...@codesourcery.com wrote:

 The new keyword is C-only (C++0x has a different way of declaring
 non-returning functions) and I did not try to make the header do
 anything useful if included in C++ code.

I would suggest you don't define it all as macro when __cplusplus is defined.