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

Jason Merrill jason@redhat.com
Tue Sep 30 14:20:00 GMT 2014


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



More information about the Gcc-patches mailing list