Re: SD-6 C++ feature-testing macros for 4.9

2014-10-07 Thread Jason Merrill

On 10/04/2014 07:28 PM, Ed Smith-Rowland wrote:

This really does build clean and test clean on x86_64-linux.
It's basically the same as for 5.0 except experimental/any isn't in and
variable templates aren't in.


OK.

Jason



SD-6 C++ feature-testing macros for 4.9

2014-10-04 Thread Ed Smith-Rowland

On 10/02/2014 11:42 AM, Jonathan Wakely wrote:

The library macros are safe and can't cause any issues, so I'm happy for them 
to go on the branch.

I can think of at least two that aren't implemented on the branch: 
experimental/any and the std::is_final trait (although I'd be OK with the 
trait going on the branch too).



- Original Message -
From: Jason Merrill ja...@redhat.com
To: Ed Smith-Rowland 3dw...@verizon.net, Jonathan Wakely 
jwak...@redhat.com
Cc: gcc-patches@gcc.gnu.org, thiago macieira thiago.macie...@intel.com
Sent: Thursday, 2 October, 2014 4:40:03 PM
Subject: Re: feature-testing macros for 4.9

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

We've had a request from someone that we include SD-6 feature testing
for gcc-4.9.
It seems rather heavy for a backport but it might make maintainers of
large C++ libraries happy ;-) and it might make sense as people migrate
from 4.9 to 5.0 to see what we've added.

I'm open to that.

Jason




OK,

This really does build clean and test clean on x86_64-linux.
It's basically the same as for 5.0 except experimental/any isn't in and 
variable templates aren't in.


I put std::is_final into 4.9 earlier - this patch adds the macro for 
that too.


I made this into a single grand unified patch this time.  i didn't think 
splitting it lat time bought me much.


Ed


libcpp/

2014-10-05  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.


gcc/c-family/

2014-10-05  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.


libstdc++-v3/

2014-10-05  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.


gcc/testsuite/

2014-10-05  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: libcpp/internal.h
===
--- libcpp/internal.h   (revision 215826)
+++ libcpp/internal.h   (working copy)
@@ -258,6 +258,9 @@
   /* Nonzero when parsing arguments to a function-like macro.  */
   unsigned char parsing_args;
 
+  /* Nonzero if in a __has_include__ or __has_include_next__ statement.  */
+  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