Re: [PATCH C++] - SD-6 Implementation Part 4 - Test suite.

2014-10-09 Thread Matthias Klose
Am 07.09.2014 um 03:48 schrieb Ed Smith-Rowland:
 Greetings,
 
 I am finally getting back to my SD-6 C++ features test work.
 
 This adds front end and preprocessor tests for the language feature tests and
 __has_include.
 
 I am still working on the fifth and last in this series to add
 __had_cpp_attribute but these first four patches add a very useful subset of 
 the
 SD-6 feature testing.
 
 Bootstrapped and tested under x86_64-linux.

apparently this was checked in on the 4.9 branch as well. However the cxx14.X
testcase fails with:

ERROR: g++.dg/cpp1y/feat-cxx14.C -std=gnu++98: syntax error in target selector
target c++14 for  dg-do 1 compile { target c++14 } 
UNRESOLVED: g++.dg/cpp1y/feat-cxx14.C -std=gnu++98: syntax error in target
selector target c++14 for  dg-do 1 compile { target c++14 } 
ERROR: g++.dg/cpp1y/feat-cxx14.C -std=gnu++11: syntax error in target selector
target c++14 for  dg-do 1 compile { target c++14 } 
UNRESOLVED: g++.dg/cpp1y/feat-cxx14.C -std=gnu++11: syntax error in target
selector target c++14 for  dg-do 1 compile { target c++14 } 
ERROR: g++.dg/cpp1y/feat-cxx14.C -std=gnu++1y: syntax error in target selector
target c++14 for  dg-do 1 compile { target c++14 } 
UNRESOLVED: g++.dg/cpp1y/feat-cxx14.C -std=gnu++1y: syntax error in target
selector target c++14 for  dg-do 1 compile { target c++14 } 



Re: [PATCH C++] - SD-6 Implementation Part 3 - .

2014-10-02 Thread Ed Smith-Rowland

On 10/01/2014 11:28 AM, Jonathan Wakely wrote:

On 02/09/14 10:24 +0100, Jonathan Wakely wrote:

On 01/09/14 21:46 -0400, Ed Smith-Rowland wrote:

Index: include/bits/stl_function.h
===
--- include/bits/stl_function.h(revision 214680)
+++ include/bits/stl_function.h(working copy)
@@ -217,6 +217,10 @@
   };

#if __cplusplus  201103L
+
+#define __cpp_lib_transparent_operators 201210
+#define __cpp_lib_generic_associative_lookup 201304


The generic associative lookup feature is not supported.


Index: testsuite/experimental/feat-lib-fund.cc
===
--- testsuite/experimental/feat-lib-fund.cc(revision 0)
+++ testsuite/experimental/feat-lib-fund.cc(working copy)
@@ -0,0 +1,25 @@
+// { dg-options -std=gnu++14 }
+// { dg-do compile }
+
+#include experimental/optional
+#include experimental/string_view
+
+#if !__has_include(experimental/optional)
+#  error experimental/optional
+#endif
+
+//#if !__has_include(experimental/net)
+//#  error experimental/net
+//#endif
+
+//#if !__has_include(experimental/any)
+//#  error experimental/any
+//#endif


This can be uncommented, experimental/any is available.

OK with those changes.


Ed, the commit at http://gcc.gnu.org/r215752 doesn't have the
corrections I asked for above and causes a number of test failures,
could you look into it please?



OK,

Here is the patch.

Built and tested on x86_64-linux.

OK?

Ed

FWIW, I remember a svn tree corruption while getting this patch ready.
I should have retested everything in the new tree.
Sorry everyone!

2014-10-02  Edward Smith-Rowland  3dw...@verizon.net

* include/bits/stl_function.h: generic associative lookup feature
is not supported.
* testsuite/experimental/feat-lib-fund.cc:experimental/any is
actually available.
* testsuite/experimental/feat-cxx14.cc: Add test for __cpp_lib_is_final.
* testsuite/20_util/declval/requirements/1_neg.cc: Adjust.
* testsuite/20_util/duration/literals/range.cc: Adjust.
* testsuite/20_util/duration/requirements/typedefs_neg1.cc: Adjust.
* testsuite/20_util/duration/requirements/typedefs_neg2.cc: Adjust.
* testsuite/20_util/duration/requirements/typedefs_neg3.cc: Adjust.
* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Adjust.
* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Adjust.
* testsuite/23_containers/array/tuple_interface/get_neg.cc: Adjust.
* testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc:
Adjust.

Index: include/bits/stl_function.h
===
--- include/bits/stl_function.h (revision 215788)
+++ include/bits/stl_function.h (working copy)
@@ -219,7 +219,7 @@
 #if __cplusplus  201103L
 
 #define __cpp_lib_transparent_operators 201210
-#define __cpp_lib_generic_associative_lookup 201304
+//#define __cpp_lib_generic_associative_lookup 201304
 
   template
 struct plusvoid
Index: testsuite/experimental/feat-lib-fund.cc
===
--- testsuite/experimental/feat-lib-fund.cc (revision 215788)
+++ testsuite/experimental/feat-lib-fund.cc (working copy)
@@ -12,9 +12,9 @@
 //#  error experimental/net
 //#endif
 
-//#if !__has_include(experimental/any)
-//#  error experimental/any
-//#endif
+#if !__has_include(experimental/any)
+#  error experimental/any
+#endif
 
 //#if !__has_include(experimental/memory_resource)
 //#  error experimental/memory_resource
Index: testsuite/experimental/feat-cxx14.cc
===
--- testsuite/experimental/feat-cxx14.cc(revision 215788)
+++ testsuite/experimental/feat-cxx14.cc(working copy)
@@ -78,11 +78,11 @@
 #  error __cpp_lib_complex_udls != 201309
 #endif
 
-#ifndef  __cpp_lib_generic_associative_lookup
-#  error __cpp_lib_generic_associative_lookup
-#elif  __cpp_lib_generic_associative_lookup != 201304
-#  error __cpp_lib_generic_associative_lookup != 201304
-#endif
+//#ifndef  __cpp_lib_generic_associative_lookup
+//#  error __cpp_lib_generic_associative_lookup
+//#elif  __cpp_lib_generic_associative_lookup != 201304
+//#  error __cpp_lib_generic_associative_lookup != 201304
+//#endif
 
 //#ifndef  __cpp_lib_null_iterators
 //#  error __cpp_lib_null_iterators
@@ -111,3 +111,9 @@
 #elif  __cpp_lib_shared_timed_mutex != 201402
 #  error __cpp_lib_shared_timed_mutex != 201402
 #endif
+
+#ifndef  __cpp_lib_is_final
+#  error __cpp_lib_is_final
+#elif  __cpp_lib_is_final != 201402
+#  error __cpp_lib_is_final != 201402
+#endif
Index: testsuite/20_util/declval/requirements/1_neg.cc
===
--- testsuite/20_util/declval/requirements/1_neg.cc (revision 215788)
+++ 

Re: [PATCH C++] - SD-6 Implementation Part 3 - .

2014-10-02 Thread Ed Smith-Rowland

On 10/02/2014 02:51 AM, Ed Smith-Rowland wrote:

On 10/01/2014 11:28 AM, Jonathan Wakely wrote:

On 02/09/14 10:24 +0100, Jonathan Wakely wrote:

On 01/09/14 21:46 -0400, Ed Smith-Rowland wrote:

Index: include/bits/stl_function.h
===
--- include/bits/stl_function.h(revision 214680)
+++ include/bits/stl_function.h(working copy)
@@ -217,6 +217,10 @@
   };

#if __cplusplus  201103L
+
+#define __cpp_lib_transparent_operators 201210
+#define __cpp_lib_generic_associative_lookup 201304


The generic associative lookup feature is not supported.


Index: testsuite/experimental/feat-lib-fund.cc
===
--- testsuite/experimental/feat-lib-fund.cc(revision 0)
+++ testsuite/experimental/feat-lib-fund.cc(working copy)
@@ -0,0 +1,25 @@
+// { dg-options -std=gnu++14 }
+// { dg-do compile }
+
+#include experimental/optional
+#include experimental/string_view
+
+#if !__has_include(experimental/optional)
+#  error experimental/optional
+#endif
+
+//#if !__has_include(experimental/net)
+//#  error experimental/net
+//#endif
+
+//#if !__has_include(experimental/any)
+//#  error experimental/any
+//#endif


This can be uncommented, experimental/any is available.

OK with those changes.


Ed, the commit at http://gcc.gnu.org/r215752 doesn't have the
corrections I asked for above and causes a number of test failures,
could you look into it please?



OK,

Here is the patch.

Built and tested on x86_64-linux.

OK?

Ed

FWIW, I remember a svn tree corruption while getting this patch ready.
I should have retested everything in the new tree.
Sorry everyone!


Here is a front-end test patch.
Built and tested on x86_64-linux.
OK?
Ed

2014-10-02  Edward Smith-Rowland  3dw...@verizon.net

* g++.dg/cpp1y/feat-cxx98-neg.C: Fix double negative thinko and
add many more tests.

Index: g++.dg/cpp1y/feat-cxx98-neg.C
===
--- g++.dg/cpp1y/feat-cxx98-neg.C   (revision 215793)
+++ g++.dg/cpp1y/feat-cxx98-neg.C   (working copy)
@@ -1,6 +1,99 @@
 // { dg-do compile { target c++98_only } }
 // { dg-options -ansi }
 
-#ifdef __cpp_runtime_arrays
+#ifndef __cpp_runtime_arrays
 #  error __cpp_runtime_arrays // { dg-error error }
 #endif
+
+#ifndef __cpp_unicode_characters
+#  error __cpp_unicode_characters // { dg-error error }
+#endif
+
+#ifndef __cpp_raw_strings
+#  error __cpp_raw_strings // { dg-error error }
+#endif
+
+#ifndef __cpp_unicode_literals
+#  error __cpp_unicode_literals // { dg-error error }
+#endif
+
+#ifndef __cpp_user_defined_literals
+#  error __cpp_user_defined_literals // { dg-error error }
+#endif
+
+#ifndef __cpp_lambdas
+#  error __cpp_lambdas // { dg-error error }
+#endif
+
+#ifndef __cpp_constexpr
+#  error __cpp_constexpr // { dg-error error }
+#endif
+
+#ifndef __cpp_static_assert
+#  error __cpp_static_assert // { dg-error error }
+#endif
+
+#ifndef __cpp_decltype
+#  error __cpp_decltype // { dg-error error }
+#endif
+
+#ifndef __cpp_attributes
+#  error __cpp_attributes // { dg-error error }
+#endif
+
+#ifndef __cpp_rvalue_reference
+#  error __cpp_rvalue_reference // { dg-error error }
+#endif
+
+#ifndef __cpp_variadic_templates
+#  error __cpp_variadic_templates // { dg-error error }
+#endif
+
+#ifndef __cpp_alias_templates
+#  error __cpp_alias_templates // { dg-error error }
+#endif
+
+// C++14
+
+// C++98 gets binary literals.
+//#ifndef __cpp_binary_literals
+//#  error __cpp_binary_literals
+//#endif
+
+#ifndef __cpp_init_captures
+#  error __cpp_init_captures // { dg-error error }
+#endif
+
+#ifndef __cpp_generic_lambdas
+#  error __cpp_generic_lambdas // { dg-error error }
+#endif
+
+#ifndef __cpp_decltype_auto
+#  error __cpp_decltype_auto // { dg-error error }
+#endif
+
+#ifndef __cpp_return_type_deduction
+#  error __cpp_return_type_deduction // { dg-error error }
+#endif
+
+//  Aggregate initializers not in yet.
+//#ifdef __cpp_aggregate_nsdmi
+//#  error __cpp_aggregate_nsdmi
+//#endif
+
+#ifndef __cpp_variable_templates
+#  error __cpp_variable_templates // { dg-error error }
+#endif
+
+#ifndef __cpp_digit_separators
+#  error __cpp_digit_separators // { dg-error error }
+#endif
+
+#ifndef __cpp_attribute_deprecated
+#  error __cpp_attribute_deprecated // { dg-error error }
+#endif
+
+//  Sized deallocation not in yet.
+//#ifdef __cpp_sized_deallocation
+//#  error __cpp_sized_deallocation
+//#endif


Re: [PATCH C++] - SD-6 Implementation Part 3 - .

2014-10-02 Thread Jonathan Wakely

On 02/10/14 02:51 -0400, Ed Smith-Rowland wrote:

On 10/01/2014 11:28 AM, Jonathan Wakely wrote:

Ed, the commit at http://gcc.gnu.org/r215752 doesn't have the
corrections I asked for above and causes a number of test failures,
could you look into it please?



OK,

Here is the patch.

Built and tested on x86_64-linux.

OK?


Yes, the library change is OK, thanks for the quick fix.


Re: [PATCH C++] - SD-6 Implementation Part 3 - .

2014-10-02 Thread Paolo Carlini

Hi,

On 10/02/2014 10:08 AM, Ed Smith-Rowland wrote:

On 10/02/2014 02:51 AM, Ed Smith-Rowland wrote:

On 10/01/2014 11:28 AM, Jonathan Wakely wrote:

On 02/09/14 10:24 +0100, Jonathan Wakely wrote:

On 01/09/14 21:46 -0400, Ed Smith-Rowland wrote:

Index: include/bits/stl_function.h
===
--- include/bits/stl_function.h(revision 214680)
+++ include/bits/stl_function.h(working copy)
@@ -217,6 +217,10 @@
   };

#if __cplusplus  201103L
+
+#define __cpp_lib_transparent_operators 201210
+#define __cpp_lib_generic_associative_lookup 201304


The generic associative lookup feature is not supported.


Index: testsuite/experimental/feat-lib-fund.cc
===
--- testsuite/experimental/feat-lib-fund.cc(revision 0)
+++ testsuite/experimental/feat-lib-fund.cc(working copy)
@@ -0,0 +1,25 @@
+// { dg-options -std=gnu++14 }
+// { dg-do compile }
+
+#include experimental/optional
+#include experimental/string_view
+
+#if !__has_include(experimental/optional)
+#  error experimental/optional
+#endif
+
+//#if !__has_include(experimental/net)
+//#  error experimental/net
+//#endif
+
+//#if !__has_include(experimental/any)
+//#  error experimental/any
+//#endif


This can be uncommented, experimental/any is available.

OK with those changes.


Ed, the commit at http://gcc.gnu.org/r215752 doesn't have the
corrections I asked for above and causes a number of test failures,
could you look into it please?



OK,

Here is the patch.

Built and tested on x86_64-linux.

OK?

Ed

FWIW, I remember a svn tree corruption while getting this patch ready.
I should have retested everything in the new tree.
Sorry everyone!


Here is a front-end test patch.
Built and tested on x86_64-linux.
OK?
Having double checked that it works to avoid the spurious fail, I'm 
going to apply the patch as obvious.


Thanks,
Paolo.


Re: [PATCH C++] - SD-6 Implementation Part 3 - .

2014-10-01 Thread Jonathan Wakely

On 02/09/14 10:24 +0100, Jonathan Wakely wrote:

On 01/09/14 21:46 -0400, Ed Smith-Rowland wrote:

Index: include/bits/stl_function.h
===
--- include/bits/stl_function.h (revision 214680)
+++ include/bits/stl_function.h (working copy)
@@ -217,6 +217,10 @@
   };

#if __cplusplus  201103L
+
+#define __cpp_lib_transparent_operators 201210
+#define __cpp_lib_generic_associative_lookup 201304


The generic associative lookup feature is not supported.


Index: testsuite/experimental/feat-lib-fund.cc
===
--- testsuite/experimental/feat-lib-fund.cc (revision 0)
+++ testsuite/experimental/feat-lib-fund.cc (working copy)
@@ -0,0 +1,25 @@
+// { dg-options -std=gnu++14 }
+// { dg-do compile }
+
+#include experimental/optional
+#include experimental/string_view
+
+#if !__has_include(experimental/optional)
+#  error experimental/optional
+#endif
+
+//#if !__has_include(experimental/net)
+//#  error experimental/net
+//#endif
+
+//#if !__has_include(experimental/any)
+//#  error experimental/any
+//#endif


This can be uncommented, experimental/any is available.

OK with those changes.


Ed, the commit at http://gcc.gnu.org/r215752 doesn't have the
corrections I asked for above and causes a number of test failures,
could you look into it please?



Re: Re: [PATCH C++] - SD-6 Implementation Part 3 - .

2014-10-01 Thread Ed Smith-Rowland
 
 

On 10/01/14, Jonathan Wakely wrote:

On 02/09/14 10:24 +0100, Jonathan Wakely wrote:
On 01/09/14 21:46 -0400, Ed Smith-Rowland wrote:
Index: include/bits/stl_function.h
===
--- include/bits/stl_function.h (revision 214680)
+++ include/bits/stl_function.h (working copy)
@@ -217,6 +217,10 @@
 };

#if __cplusplus  201103L
+
+#define __cpp_lib_transparent_operators 201210
+#define __cpp_lib_generic_associative_lookup 201304

The generic associative lookup feature is not supported.

Index: testsuite/experimental/feat-lib-fund.cc
===
--- testsuite/experimental/feat-lib-fund.cc (revision 0)
+++ testsuite/experimental/feat-lib-fund.cc (working copy)
@@ -0,0 +1,25 @@
+// { dg-options -std=gnu++14 }
+// { dg-do compile }
+
+#include experimental/optional
+#include experimental/string_view
+
+#if !__has_include(experimental/optional)
+# error experimental/optional
+#endif
+
+//#if !__has_include(experimental/net)
+//# error experimental/net
+//#endif
+
+//#if !__has_include(experimental/any)
+//# error experimental/any
+//#endif

This can be uncommented, experimental/any is available.

OK with those changes.

Ed, the commit at http://gcc.gnu.org/r215752 doesn't have the
corrections I asked for above and causes a number of test failures,
could you look into it please?

I swore I put these changes in.
I'll fix these ASAP.
Ed



Re: [PATCH C++] - SD-6 Implementation Part 1 - __has_include.

2014-09-30 Thread Jason Merrill

On 09/29/2014 11:18 AM, Ed Smith-Rowland wrote:

+  /* Nonzero to prevent macro expansion.  */
+  unsigned char in__has_include__;


I don't see anything checking this flag to prevent macro expansion. 
Does the comment just need a change?



+  /* Binary literals and variable length arrays have been allowed in g++
+before C++11 and were standardized for C++14.  */
+  if (!pedantic || cxx_dialect  cxx11)
+   {
+ cpp_define (pfile, __cpp_binary_literals=201304);
+   }


This comment also needs an update.


+//  Try a macro.
+#define COMPLEX_INC complex.h
+#if __has_include(COMPLEX_INC)
+#else
+#  error COMPLEX_INC
+#endif


Are you sure this is what SD-6 means?  I interpret it as trying to 
specify something equivalent to the #include directive, namely that 
first we look for an explicit header-name, then try a more flexible 
parse that should include macro expansion.  But this can wait for a 
clarification from SG10.


The patch is OK with those comment tweaks.

Jason



Re: [PATCH C++] - SD-6 Implementation Part 1 - __has_include.

2014-09-29 Thread Ed Smith-Rowland

On 09/25/2014 12:57 PM, Jason Merrill wrote:

On 09/01/2014 09:34 PM, Ed Smith-Rowland wrote:

(open_file_failed()): Not an error to not find a header file for
__has_include__.


Hmm, looks like this means that __has_include__ will silently return 
false if a header exists but is unreadable; I would think that we want 
it to be true (and have an error when the user tries to include it).


Jason


Here is the new patch series.

A patch addressing C++11 [[deprecated]] is coming later when these are 
in as is a library patch for std::is_final.


I flipped the logic on the libcpp functions because there was a double 
negative of sorts - the logic was confusing to me on second look.
Also, a file that a user can't read for permissions still returns true 
with __has_include.


Built and tested on x86_64-linux.

OK?

2014-09-29  Edward Smith-Rowland  3dw...@verizon.net

Implement SD-6: SG10 Feature Test Recommendations
* internal.h (lexer_state, spec_nodes): Add in__has_include__.
* directives.c: Support __has_include__ builtin.
* expr.c (parse_has_include): New function to parse __has_include__
builtin; (eval_token()): Use it.
* files.c (_cpp_has_header()): New funtion to look for header;
(open_file_failed()): Not an error to not find a header file for
__has_include__.
* identifiers.c (_cpp_init_hashtable()): Add entry for __has_include__.
* pch.c (cpp_read_state): Lookup __has_include__.
* traditional.c (enum ls, _cpp_scan_out_logical_line()): Walk through
__has_include__ statements.

Index: internal.h
===
--- internal.h  (revision 215628)
+++ internal.h  (working copy)
@@ -258,6 +258,9 @@
   /* Nonzero when parsing arguments to a function-like macro.  */
   unsigned char parsing_args;
 
+  /* Nonzero to prevent macro expansion.  */
+  unsigned char in__has_include__;
+
   /* Nonzero if prevent_expansion is true only because output is
  being discarded.  */
   unsigned char discarding_output;
@@ -279,6 +282,8 @@
   cpp_hashnode *n_true;/* C++ keyword true */
   cpp_hashnode *n_false;   /* C++ keyword false */
   cpp_hashnode *n__VA_ARGS__;  /* C99 vararg macros */
+  cpp_hashnode *n__has_include__;  /* __has_include__ operator */
+  cpp_hashnode *n__has_include_next__; /* __has_include_next__ operator */
 };
 
 typedef struct _cpp_line_note _cpp_line_note;
@@ -645,6 +650,8 @@
 extern bool _cpp_read_file_entries (cpp_reader *, FILE *);
 extern const char *_cpp_get_file_name (_cpp_file *);
 extern struct stat *_cpp_get_file_stat (_cpp_file *);
+extern bool _cpp_has_header (cpp_reader *, const char *, int,
+enum include_type);
 
 /* In expr.c */
 extern bool _cpp_parse_expr (cpp_reader *, bool);
@@ -680,6 +687,7 @@
 extern void _cpp_do_file_change (cpp_reader *, enum lc_reason, const char *,
 linenum_type, unsigned int);
 extern void _cpp_pop_buffer (cpp_reader *);
+extern char *_cpp_bracket_include (cpp_reader *);
 
 /* In directives.c */
 struct _cpp_dir_only_callbacks
Index: directives.c
===
--- directives.c(revision 215628)
+++ directives.c(working copy)
@@ -566,6 +566,11 @@
   if (is_def_or_undef  node == pfile-spec_nodes.n_defined)
cpp_error (pfile, CPP_DL_ERROR,
   \defined\ cannot be used as a macro name);
+  else if (is_def_or_undef
+(node == pfile-spec_nodes.n__has_include__
+|| node == pfile-spec_nodes.n__has_include_next__))
+   cpp_error (pfile, CPP_DL_ERROR,
+  \__has_include__\ cannot be used as a macro name);
   else if (! (node-flags  NODE_POISONED))
return node;
 }
@@ -2623,3 +2628,12 @@
   node-directive_index = i;
 }
 }
+
+/* Extract header file from a bracket include. Parsing starts after ''.
+   The string is malloced and must be freed by the caller.  */
+char *
+_cpp_bracket_include(cpp_reader *pfile)
+{
+  return glue_header_name (pfile);
+}
+
Index: expr.c
===
--- expr.c  (revision 215628)
+++ expr.c  (working copy)
@@ -64,6 +64,8 @@
 static unsigned int interpret_int_suffix (cpp_reader *, const uchar *, size_t);
 static void check_promotion (cpp_reader *, const struct op *);
 
+static cpp_num parse_has_include (cpp_reader *, enum include_type);
+
 /* Token type abuse to create unary plus and minus operators.  */
 #define CPP_UPLUS ((enum cpp_ttype) (CPP_LAST_CPP_OP + 1))
 #define CPP_UMINUS ((enum cpp_ttype) (CPP_LAST_CPP_OP + 2))
@@ -1048,6 +1050,10 @@
 case CPP_NAME:
   if (token-val.node.node == pfile-spec_nodes.n_defined)
return parse_defined (pfile);
+  else if (token-val.node.node == pfile-spec_nodes.n__has_include__)
+   return 

Re: [PATCH C++] - SD-6 Implementation Part 1 - __has_include.

2014-09-28 Thread Ed Smith-Rowland

On 09/25/2014 12:57 PM, Jason Merrill wrote:

On 09/01/2014 09:34 PM, Ed Smith-Rowland wrote:

(open_file_failed()): Not an error to not find a header file for
__has_include__.


Hmm, looks like this means that __has_include__ will silently return 
false if a header exists but is unreadable; I would think that we want 
it to be true (and have an error when the user tries to include it).


Jason

I have changed __has_include__ to return true if a header exists but is 
unreadable.  Then I tried to see if an error would occur for a header of 
permission 000.
Just including it gives a permission error.  Putting it into an #if 
block does not.

---
ed@bad-horse:~/tr2$ ls -l hidden.h
-- 1 ed ed 0 Sep 26 10:27 hidden.h
---
//  Try header that exists but we can't read.
#if __has_include(hidden.h)
#  warning found hidden.h
#  include hidden.h // No error!
#else
#  error hidden.h
#endif

#if 1
#  include hidden.h // No error!
#endif
---

Is this a bug in cpp?

I'm going to submit new patches that answer all your questions.  As far 
as this one goes I do no worse than current behavior.

As for [[deprecated]] for C++11 I'll add another patch on top of the four.

Ed



Re: [PATCH C++] - SD-6 Implementation Part 2 - __has_include macro and C++ language feature macros.

2014-09-26 Thread Ed Smith-Rowland

On 09/25/2014 01:40 PM, Jason Merrill wrote:

On 09/01/2014 09:41 PM, Ed Smith-Rowland wrote:

+  cpp_define (pfile, __cpp_attribute_deprecated=201309);


Don't we support attribute deprecated in C++11?

Jason



We support [[gnu::deprecated]] in C++11 bit not [[deprecated]] until C++14.
Ed



Re: [PATCH C++] - SD-6 Implementation Part 2 - __has_include macro and C++ language feature macros.

2014-09-26 Thread Jason Merrill

On 09/26/2014 10:20 AM, Ed Smith-Rowland wrote:

On 09/25/2014 01:40 PM, Jason Merrill wrote:

Don't we support attribute deprecated in C++11?


We support [[gnu::deprecated]] in C++11 bit not [[deprecated]] until C++14.


Hmm, that seems unnecessary.  I'd allow it in C++11 as well, and *maybe* 
complain if -pedantic; 7.6/5 says For an attribute-token not specified 
in this International Standard, the behavior is implementation defined 
so allowing it is conforming.


Jason



[PING 2, PATCH C++] - SD-6 Implementation Part N/4.

2014-09-25 Thread Ed Smith-Rowland

*PING*

I would like review of my SD-6 implementation.

Part 1 - __has_include__ built-in in libcpp.
https://gcc.gnu.org/ml/gcc-patches/2014-09/msg00083.html

Part 2 - __has_include macro and C++ language feature macros.
https://gcc.gnu.org/ml/gcc-patches/2014-09/msg00084.html

Part 3 - libstdc++ library macros was already approved by Jonathan. 
Thank you.

https://gcc.gnu.org/ml/gcc-patches/2014-09/msg00085.html
https://gcc.gnu.org/ml/gcc-patches/2014-09/msg00110.html

Part 4 - C++ front end tests.
https://gcc.gnu.org/ml/gcc-patches/2014-09/msg00553.html

These build and test cleanly on x86_64-linux.

Part 5 - __has_cpp_attribute and supporting machinery is proving more 
interesting than I thought.

But the rest should be put in.

Thank you,
Ed Smith-Rowland



Re: [PATCH C++] - SD-6 Implementation Part 1 - __has_include.

2014-09-25 Thread Jason Merrill

On 09/01/2014 09:34 PM, Ed Smith-Rowland wrote:

(open_file_failed()): Not an error to not find a header file for
__has_include__.


Hmm, looks like this means that __has_include__ will silently return 
false if a header exists but is unreadable; I would think that we want 
it to be true (and have an error when the user tries to include it).


Jason


Re: [PATCH C++] - SD-6 Implementation Part 2 - __has_include macro and C++ language feature macros.

2014-09-25 Thread Jason Merrill

On 09/01/2014 09:41 PM, Ed Smith-Rowland wrote:

+ /* Return type deduction was added as an extension to C++11
+and was standardized for C+14.  */
+ cpp_define (pfile, __cpp_return_type_deduction=201304);


When I try to use it with -std=c++11 I get

wa.C:1:8: error: ‘f’ function uses ‘auto’ type specifier without 
trailing return type

 auto f() { return 42; }
^
wa.C:1:8: note: deduced return type only available with -std=c++14 or 
-std=gnu++14


Let's move it to the C++14 section.


There is one bit: arrays of runtime bound.  These got kicked out of C++14 I 
think and is languishing in a TS.
OTOH, we still support it.  It's better than the C99 version we supported.
What direction should I take?
/*  Runtime sized arrays
+have C++14 semantics even for C++98.  */


The comment is inaccurate; most of the restrictions on arrays of runtime 
bound are only applied in C++14 mode.  Let's put this macro in the C++14 
section as well until there's a value or separate macro indicating C99 
VLA support.


Jason



Re: [PATCH C++] - SD-6 Implementation Part 2 - __has_include macro and C++ language feature macros.

2014-09-25 Thread Jason Merrill

On 09/01/2014 09:41 PM, Ed Smith-Rowland wrote:

+ cpp_define (pfile, __cpp_attribute_deprecated=201309);


Don't we support attribute deprecated in C++11?

Jason



[PATCH C++] - SD-6 Implementation Part 4 - Test suite.

2014-09-06 Thread Ed Smith-Rowland

Greetings,

I am finally getting back to my SD-6 C++ features test work.

This adds front end and preprocessor tests for the language feature tests and 
__has_include.

I am still working on the fifth and last in this series to add 
__had_cpp_attribute but these first four patches add a very useful subset of 
the SD-6 feature testing.

Bootstrapped and tested under x86_64-linux.

OK?

Ed

2014-09-06  Edward Smith-Rowland  3dw...@verizon.net

Implement SD-6: SG10 Feature Test Recommendations
* g++.dg/cpp1y/feat-cxx11-neg.C: New.
* g++.dg/cpp1y/feat-cxx11.C: New.
* g++.dg/cpp1y/feat-cxx14.C: New.
* g++.dg/cpp1y/feat-cxx98.C: New.
* g++.dg/cpp1y/feat-cxx98-neg.C: New.
* g++.dg/cpp1y/phoobhar.h: New.
* g++.dg/cpp1y/testinc/phoobhar.h: New.

Index: g++.dg/cpp1y/feat-cxx11-neg.C
===
--- g++.dg/cpp1y/feat-cxx11-neg.C   (revision 0)
+++ g++.dg/cpp1y/feat-cxx11-neg.C   (working copy)
@@ -0,0 +1,32 @@
+// { dg-do compile { target c++11_only } }
+// { dg-options -pedantic-errors }
+
+// These *are* defined in C++14 onwards.
+
+#ifndef __cpp_binary_literals
+#  error __cpp_binary_literals // { dg-error error }
+#endif
+
+#ifndef __cpp_init_captures
+#  error __cpp_init_captures // { dg-error error }
+#endif
+
+#ifndef __cpp_generic_lambdas
+#  error __cpp_generic_lambdas // { dg-error error }
+#endif
+
+#ifndef __cpp_decltype_auto
+#  error __cpp_decltype_auto // { dg-error error }
+#endif
+
+#ifndef __cpp_runtime_arrays
+#  error __cpp_runtime_arrays // { dg-error error }
+#endif
+
+#ifndef __cpp_digit_separators
+#  error __cpp_digit_separators // { dg-error error }
+#endif
+
+#ifndef __cpp_attribute_deprecated
+#  error __cpp_attribute_deprecated // { dg-error error }
+#endif
Index: g++.dg/cpp1y/feat-cxx11.C
===
--- g++.dg/cpp1y/feat-cxx11.C   (revision 0)
+++ g++.dg/cpp1y/feat-cxx11.C   (working copy)
@@ -0,0 +1,94 @@
+// { dg-do compile }
+// { dg-options -std=gnu++11 }
+
+#ifndef __cpp_unicode_characters
+#  error __cpp_unicode_characters
+#elif __cpp_unicode_characters != 200704
+#  error __cpp_unicode_characters != 200704
+#endif
+
+#ifndef __cpp_raw_strings
+#  error __cpp_raw_strings
+#elif __cpp_raw_strings != 200710
+#  error __cpp_raw_strings != 200710
+#endif
+
+#ifndef __cpp_unicode_literals
+#  error __cpp_unicode_literals
+#elif __cpp_unicode_literals != 200710
+#  error __cpp_unicode_literals != 200710
+#endif
+
+#ifndef __cpp_user_defined_literals
+#  error __cpp_user_defined_literals
+#elif __cpp_user_defined_literals != 200809
+#  error __cpp_user_defined_literals != 200809
+#endif
+
+#ifndef __cpp_lambdas
+#  error __cpp_lambdas
+#elif __cpp_lambdas != 200907
+#  error __cpp_lambdas != 200907
+#endif
+
+#ifndef __cpp_constexpr
+#  error __cpp_constexpr
+#elif __cpp_constexpr != 200704
+#  error __cpp_constexpr != 200704
+#endif
+
+#ifndef __cpp_static_assert
+#  error __cpp_static_assert
+#elif __cpp_static_assert != 200410
+#  error __cpp_static_assert != 200410
+#endif
+
+#ifndef __cpp_decltype
+#  error __cpp_decltype
+#elif __cpp_decltype != 200707
+#  error __cpp_decltype != 200707
+#endif
+
+#ifndef __cpp_attributes
+#  error __cpp_attributes
+#elif __cpp_attributes != 200809
+#  error __cpp_attributes != 200809
+#endif
+
+#ifndef __cpp_rvalue_reference
+#  error __cpp_rvalue_reference
+#elif __cpp_rvalue_reference != 200610
+#  error __cpp_rvalue_reference != 200610
+#endif
+
+#ifndef __cpp_variadic_templates
+#  error __cpp_variadic_templates
+#elif __cpp_variadic_templates != 200704
+#  error __cpp_variadic_templates != 200704
+#endif
+
+#ifndef __cpp_alias_templates
+#  error __cpp_alias_templates
+#elif __cpp_alias_templates != 200704
+#  error __cpp_alias_templates != 200704
+#endif
+
+//  This C++14 feature was developed as an extension for C++11.
+#ifndef __cpp_return_type_deduction
+#  error __cpp_return_type_deduction
+#elif __cpp_return_type_deduction != 201304
+#  error __cpp_return_type_deduction != 201304
+#endif
+
+//  These C++14 features are allowed in C++11 in non-ANSI modes.
+#ifndef __cpp_binary_literals
+#  error __cpp_binary_literals
+#elif __cpp_binary_literals != 201304
+#  error __cpp_binary_literals != 201304
+#endif
+
+#ifndef __cpp_runtime_arrays
+#  error __cpp_runtime_arrays
+#elif __cpp_runtime_arrays != 201304
+#  error __cpp_runtime_arrays != 201304
+#endif
Index: g++.dg/cpp1y/feat-cxx14.C
===
--- g++.dg/cpp1y/feat-cxx14.C   (revision 0)
+++ g++.dg/cpp1y/feat-cxx14.C   (working copy)
@@ -0,0 +1,232 @@
+// { dg-do compile { target c++14 } }
+// { dg-options -I${srcdir}/g++.dg/cpp1y -I${srcdir}/g++.dg/cpp1y/testinc }
+
+// Begin C++11 tests.
+
+#ifndef __cpp_unicode_characters
+#  error __cpp_unicode_characters
+#elif __cpp_unicode_characters != 200704
+#  error __cpp_unicode_characters != 200704

Re: [PATCH C++] - SD-6 Implementation Part 3 - .

2014-09-02 Thread Jonathan Wakely

On 01/09/14 21:46 -0400, Ed Smith-Rowland wrote:

Index: include/bits/stl_function.h
===
--- include/bits/stl_function.h (revision 214680)
+++ include/bits/stl_function.h (working copy)
@@ -217,6 +217,10 @@
};

#if __cplusplus  201103L
+
+#define __cpp_lib_transparent_operators 201210
+#define __cpp_lib_generic_associative_lookup 201304


The generic associative lookup feature is not supported.


Index: testsuite/experimental/feat-lib-fund.cc
===
--- testsuite/experimental/feat-lib-fund.cc (revision 0)
+++ testsuite/experimental/feat-lib-fund.cc (working copy)
@@ -0,0 +1,25 @@
+// { dg-options -std=gnu++14 }
+// { dg-do compile }
+
+#include experimental/optional
+#include experimental/string_view
+
+#if !__has_include(experimental/optional)
+#  error experimental/optional
+#endif
+
+//#if !__has_include(experimental/net)
+//#  error experimental/net
+//#endif
+
+//#if !__has_include(experimental/any)
+//#  error experimental/any
+//#endif


This can be uncommented, experimental/any is available.

OK with those changes.

Once committed, can you update https://gcc.gnu.org/gcc-5/changes.html
to say GCC follows the SD-6 recommendations?

Thanks.


[PATCH C++] - SD-6 Implementation Part 1 - __has_include.

2014-09-01 Thread Ed Smith-Rowland

Greetings,

I am finally getting back to my SD-6 C++ features test work.
This first part adds a __has_include__ built-in that will return true if 
a header exists.
I also added __has_include_next__ as an extension.  Clang has this 
extension.


Both these built-ins will be wrapped in function type macros in a later 
patch to c-family.


As written, these are available to the whole C-family rather than just C++.
I think this makes a valuable addition for everyone.
(I sort of wonder why this wasn't added to the actual preprocessor 20 
years ago.)


Bootstrapped and tested under x86_64-linux.

OK?

Ed

2014-09-02  Edward Smith-Rowland  3dw...@verizon.net

Implement SD-6: SG10 Feature Test Recommendations
* internal.h (lexer_state, spec_nodes): Add in__has_include__.
* directives.c: Support __has_include__ builtin.
* expr.c (parse_has_include): New function to parse __has_include__
builtin; (eval_token()): Use it.
* files.c (_cpp_has_header()): New funtion to look for header;
(open_file_failed()): Not an error to not find a header file for
__has_include__.
* identifiers.c (_cpp_init_hashtable()): Add entry for __has_include__.
* pch.c (cpp_read_state): Lookup __has_include__.
* traditional.c (enum ls, _cpp_scan_out_logical_line()): Walk through
__has_include__ statements.

Index: internal.h
===
--- internal.h  (revision 214680)
+++ internal.h  (working copy)
@@ -258,6 +258,9 @@
   /* Nonzero when parsing arguments to a function-like macro.  */
   unsigned char parsing_args;
 
+  /* Nonzero to prevent macro expansion.  */
+  unsigned char in__has_include__;
+
   /* Nonzero if prevent_expansion is true only because output is
  being discarded.  */
   unsigned char discarding_output;
@@ -279,6 +282,8 @@
   cpp_hashnode *n_true;/* C++ keyword true */
   cpp_hashnode *n_false;   /* C++ keyword false */
   cpp_hashnode *n__VA_ARGS__;  /* C99 vararg macros */
+  cpp_hashnode *n__has_include__;  /* __has_include__ operator */
+  cpp_hashnode *n__has_include_next__; /* __has_include_next__ operator */
 };
 
 typedef struct _cpp_line_note _cpp_line_note;
@@ -645,6 +650,8 @@
 extern bool _cpp_read_file_entries (cpp_reader *, FILE *);
 extern const char *_cpp_get_file_name (_cpp_file *);
 extern struct stat *_cpp_get_file_stat (_cpp_file *);
+extern bool _cpp_has_header (cpp_reader *, const char *, int,
+enum include_type);
 
 /* In expr.c */
 extern bool _cpp_parse_expr (cpp_reader *, bool);
@@ -680,6 +687,7 @@
 extern void _cpp_do_file_change (cpp_reader *, enum lc_reason, const char *,
 linenum_type, unsigned int);
 extern void _cpp_pop_buffer (cpp_reader *);
+extern char *_cpp_bracket_include (cpp_reader *);
 
 /* In directives.c */
 struct _cpp_dir_only_callbacks
Index: directives.c
===
--- directives.c(revision 214680)
+++ directives.c(working copy)
@@ -549,6 +549,11 @@
   if (is_def_or_undef  node == pfile-spec_nodes.n_defined)
cpp_error (pfile, CPP_DL_ERROR,
   \defined\ cannot be used as a macro name);
+  else if (is_def_or_undef
+(node == pfile-spec_nodes.n__has_include__
+|| node == pfile-spec_nodes.n__has_include_next__))
+   cpp_error (pfile, CPP_DL_ERROR,
+  \__has_include__\ cannot be used as a macro name);
   else if (! (node-flags  NODE_POISONED))
return node;
 }
@@ -2601,3 +2606,12 @@
   node-directive_index = i;
 }
 }
+
+/* Extract header file from a bracket include. Parsing starts after ''.
+   The string is malloced and must be freed by the caller.  */
+char *
+_cpp_bracket_include(cpp_reader *pfile)
+{
+  return glue_header_name (pfile);
+}
+
Index: expr.c
===
--- expr.c  (revision 214680)
+++ expr.c  (working copy)
@@ -64,6 +64,8 @@
 static unsigned int interpret_int_suffix (cpp_reader *, const uchar *, size_t);
 static void check_promotion (cpp_reader *, const struct op *);
 
+static cpp_num parse_has_include (cpp_reader *, enum include_type);
+
 /* Token type abuse to create unary plus and minus operators.  */
 #define CPP_UPLUS ((enum cpp_ttype) (CPP_LAST_CPP_OP + 1))
 #define CPP_UMINUS ((enum cpp_ttype) (CPP_LAST_CPP_OP + 2))
@@ -1048,6 +1050,10 @@
 case CPP_NAME:
   if (token-val.node.node == pfile-spec_nodes.n_defined)
return parse_defined (pfile);
+  else if (token-val.node.node == pfile-spec_nodes.n__has_include__)
+   return parse_has_include (pfile, IT_INCLUDE);
+  else if (token-val.node.node == pfile-spec_nodes.n__has_include_next__)
+   return parse_has_include (pfile, IT_INCLUDE_NEXT);
   else if (CPP_OPTION (pfile, cplusplus)
   

[PATCH C++] - SD-6 Implementation Part 2 - __has_include macro and C++ language feature macros.

2014-09-01 Thread Ed Smith-Rowland

Greetings,

I am finally getting back to my SD-6 C++ features test work.

This second part adds a __has_include function-like macro that will 
return true if a header exists. I also added a __has_include_next 
function-like macro as an extension. Clang has this extension.

These macros just wrap the built-ins introduced in the previous patch.

As requested by folk I have rearranged which language-feature macros are 
available with what .

There is one bit: arrays of runtime bound.  These got kicked out of C++14 I 
think and is languishing in a TS.
OTOH, we still support it.  It's better than the C99 version we supported.
What direction should I take?

Bootstrapped and tested under x86_64-linux.

OK?

Ed

2014-09-02  Edward Smith-Rowland  3dw...@verizon.net

Implement SD-6: SG10 Feature Test Recommendations
* c-cppbuiltin.c (c_cpp_builtins()): Define language feature
macros and the __has_header macro.

Index: c-cppbuiltin.c
===
--- c-cppbuiltin.c  (revision 214680)
+++ c-cppbuiltin.c  (working copy)
@@ -794,6 +794,12 @@
   /* For stddef.h.  They require macros defined in c-common.c.  */
   c_stddef_cpp_builtins ();
 
+  /* Set include test macros for all C/C++ (not for just C++11 etc.)
+ the builtins __has_include__ and __has_include_next__ are defined
+ in libcpp.  */
+  cpp_define (pfile, __has_include(STR)=__has_include__(STR));
+  cpp_define (pfile, __has_include_next(STR)=__has_include_next__(STR));
+
   if (c_dialect_cxx ())
 {
   if (flag_weak  SUPPORTS_ONE_ONLY)
@@ -800,12 +806,57 @@
cpp_define (pfile, __GXX_WEAK__=1);
   else
cpp_define (pfile, __GXX_WEAK__=0);
+
   if (warn_deprecated)
cpp_define (pfile, __DEPRECATED);
+
   if (flag_rtti)
cpp_define (pfile, __GXX_RTTI);
+
   if (cxx_dialect = cxx11)
 cpp_define (pfile, __GXX_EXPERIMENTAL_CXX0X__);
+
+  /* Binary literals and variable length arrays have been allowed in g++
+before C++11 and were standardized for C++14.  Runtime sized arrays
+have C++14 semantics even for C++98.  */
+  if (!pedantic || cxx_dialect  cxx11)
+   {
+ cpp_define (pfile, __cpp_binary_literals=201304);
+ cpp_define (pfile, __cpp_runtime_arrays=201304);
+   }
+  if (cxx_dialect = cxx11)
+   {
+ /* Set feature test macros for C++11  */
+ cpp_define (pfile, __cpp_unicode_characters=200704);
+ cpp_define (pfile, __cpp_raw_strings=200710);
+ cpp_define (pfile, __cpp_unicode_literals=200710);
+ cpp_define (pfile, __cpp_user_defined_literals=200809);
+ cpp_define (pfile, __cpp_lambdas=200907);
+ cpp_define (pfile, __cpp_constexpr=200704);
+ cpp_define (pfile, __cpp_static_assert=200410);
+ cpp_define (pfile, __cpp_decltype=200707);
+ cpp_define (pfile, __cpp_attributes=200809);
+ cpp_define (pfile, __cpp_rvalue_reference=200610);
+ cpp_define (pfile, __cpp_variadic_templates=200704);
+ cpp_define (pfile, __cpp_alias_templates=200704);
+ /* Return type deduction was added as an extension to C++11
+and was standardized for C+14.  */
+ cpp_define (pfile, __cpp_return_type_deduction=201304);
+   }
+  if (cxx_dialect  cxx11)
+   {
+ /* Set feature test macros for C++14  */
+ cpp_define (pfile, __cpp_init_captures=201304);
+ cpp_define (pfile, __cpp_generic_lambdas=201304);
+ //cpp_undef (pfile, __cpp_constexpr);
+ //cpp_define (pfile, __cpp_constexpr=201304);
+ cpp_define (pfile, __cpp_decltype_auto=201304);
+ //cpp_define (pfile, __cpp_aggregate_nsdmi=201304);
+ cpp_define (pfile, __cpp_variable_templates=201304);
+ cpp_define (pfile, __cpp_digit_separators=201309);
+ cpp_define (pfile, __cpp_attribute_deprecated=201309);
+ //cpp_define (pfile, __cpp_sized_deallocation=201309);
+   }
 }
   /* Note that we define this for C as well, so that we know if
  __attribute__((cleanup)) will interface with EH.  */


[PATCH C++] - SD-6 Implementation Part 3 - .

2014-09-01 Thread Ed Smith-Rowland

Greetings,

I am finally getting back to my SD-6 C++ features test work.

This adds feature macros to various libstdc++ components.
The new version of SD-6 cleans up the shared_mutex noise.

Some libraries that were moved to different tSen are still given macros as they 
are in the SD-6 draft.

Bootstrapped and tested under x86_64-linux.

OK?

Ed

2014-09-02  Edward Smith-Rowland  3dw...@verizon.net

Implement SD-6: SG10 Feature Test Recommendations
* include/bits/basic_string.h: Add __cpp_lib feature test macro.
* include/bits/stl_algobase.h: Ditto.
* include/bits/stl_function.h: Ditto.
* include/bits/unique_ptr.h: Ditto.
* include/std/chrono: Ditto.
* include/std/complex: Ditto.
* include/std/iomanip: Ditto.
* include/std/shared_mutex: Ditto.
* include/std/tuple: Ditto.
* include/std/type_traits: Ditto.
* include/std/utility: Ditto.
* testsuite/experimental/feat-cxx14.cc: New.
* testsuite/experimental/feat-lib-fund.cc: New.
* testsuite/20_util/declval/requirements/1_neg.cc: Adjust.
* testsuite/20_util/duration/literals/range.cc: Adjust.
* testsuite/20_util/duration/requirements/typedefs_neg1.cc: Adjust.
* testsuite/20_util/duration/requirements/typedefs_neg2.cc: Adjust.
* testsuite/20_util/duration/requirements/typedefs_neg3.cc: Adjust.
* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Adjust.
* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Adjust.
* testsuite/23_containers/array/tuple_interface/get_neg.cc: Adjust.
* testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc:
Adjust.

Index: include/bits/basic_string.h
===
--- include/bits/basic_string.h (revision 214680)
+++ include/bits/basic_string.h (working copy)
@@ -3140,6 +3140,8 @@
 
 #if __cplusplus  201103L
 
+#define __cpp_lib_string_udls 201304
+
   inline namespace literals
   {
   inline namespace string_literals
Index: include/bits/stl_algobase.h
===
--- include/bits/stl_algobase.h (revision 214680)
+++ include/bits/stl_algobase.h (working copy)
@@ -1091,6 +1091,9 @@
 }
 
 #if __cplusplus  201103L
+
+#define __cpp_lib_robust_nonmodifying_seq_ops 201304
+
   /**
*  @brief Tests a range for element-wise equality.
*  @ingroup non_mutating_algorithms
Index: include/bits/stl_function.h
===
--- include/bits/stl_function.h (revision 214680)
+++ include/bits/stl_function.h (working copy)
@@ -217,6 +217,10 @@
 };
 
 #if __cplusplus  201103L
+
+#define __cpp_lib_transparent_operators 201210
+#define __cpp_lib_generic_associative_lookup 201304
+
   template
 struct plusvoid
 {
Index: include/bits/unique_ptr.h
===
--- include/bits/unique_ptr.h   (revision 214680)
+++ include/bits/unique_ptr.h   (working copy)
@@ -743,6 +743,9 @@
 };
 
 #if __cplusplus  201103L
+
+#define __cpp_lib_make_unique 201304
+
   templatetypename _Tp
 struct _MakeUniq
 { typedef unique_ptr_Tp __single_object; };
Index: include/std/chrono
===
--- include/std/chrono  (revision 214680)
+++ include/std/chrono  (working copy)
@@ -782,6 +782,8 @@
 
 #if __cplusplus  201103L
 
+#define __cpp_lib_chrono_udls 201304
+
   inline namespace literals
   {
   inline namespace chrono_literals
Index: include/std/complex
===
--- include/std/complex (revision 214680)
+++ include/std/complex (working copy)
@@ -1929,6 +1929,8 @@
 inline namespace literals {
 inline namespace complex_literals {
 
+#define __cpp_lib_complex_udls 201309
+
   constexpr std::complexfloat
   operatorif(long double __num)
   { return std::complexfloat{0.0F, static_castfloat(__num)}; }
Index: include/std/iomanip
===
--- include/std/iomanip (revision 214680)
+++ include/std/iomanip (working copy)
@@ -339,6 +339,8 @@
 
 #if __cplusplus  201103L
 
+#define __cpp_lib_quoted_string_io 201304
+
 _GLIBCXX_END_NAMESPACE_VERSION
   namespace __detail {
   _GLIBCXX_BEGIN_NAMESPACE_VERSION
Index: include/std/shared_mutex
===
--- include/std/shared_mutex(revision 214680)
+++ include/std/shared_mutex(working copy)
@@ -52,6 +52,9 @@
*/
 
 #if defined(_GLIBCXX_HAS_GTHREADS)  defined(_GLIBCXX_USE_C99_STDINT_TR1)
+
+#define __cpp_lib_shared_timed_mutex 201402
+
   /// shared_timed_mutex
   class shared_timed_mutex
   {
Index: include/std/tuple
===
--- include/std/tuple   (revision 214680)
+++ 

[PATCH C++] - SD-6 Implementation

2014-09-01 Thread Ed Smith-Rowland

The Fourth installment, testing and other oddments will be sent tomorrow.

The implementation of __has_cpp_attribute is underway and will come in a 
few days as a Fifth installment (modulo bugs this should be all).

I have it working in C++.
I feel though that it would be welcome as it is in clang for all 
C-family languages.  I intend to offer a __has_attribute for all C 
languages.

The __has_cpp_attribute will just be for C++.

Thiago, I did not mean to clobber your work.  This has been baking for a 
while (last patches in June) and I just got back to it after a break 
with little useful attention to g++.
Perhaps we can combine our work.  I'll look over your patch.  I know you 
want this to support Qt ;-)  I think this effort will help.


Sincerely,

Ed



Re: [PATCH C++] - SD-6 Implementation

2014-09-01 Thread Thiago Macieira
On Monday 01 September 2014 21:58:47 Ed Smith-Rowland wrote:
 The Fourth installment, testing and other oddments will be sent tomorrow.
 
 The implementation of __has_cpp_attribute is underway and will come in a
 few days as a Fifth installment (modulo bugs this should be all).
 I have it working in C++.
 I feel though that it would be welcome as it is in clang for all
 C-family languages.  I intend to offer a __has_attribute for all C
 languages.
 The __has_cpp_attribute will just be for C++.
 
 Thiago, I did not mean to clobber your work.  This has been baking for a
 while (last patches in June) and I just got back to it after a break
 with little useful attention to g++.
 Perhaps we can combine our work.  I'll look over your patch.  I know you
 want this to support Qt ;-)  I think this effort will help.

Hi Ed

I don't care who does this, as long as it gets done.

Though I would appreciate if the macros were added to the 4.9 branch, as the 
C++11 and 14 features are already there.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center



Re: [PATCH C++] - SD-6 Implementation Part 1 - __has_include.

2014-09-01 Thread Mike Stump
On Sep 1, 2014, at 6:34 PM, Ed Smith-Rowland 3dw...@verizon.net wrote:
 (I sort of wonder why this wasn't added to the actual preprocessor 20 years 
 ago.)

:-)

So can you hack the system at template expansion time yet?  :-)  
std::shell“/bin/sh -c …” maybe?