On Fri, Mar 20, 2015 at 01:15:52PM -0400, Jason Merrill wrote: > On 03/20/2015 12:48 PM, Jakub Jelinek wrote: > >On Fri, Mar 20, 2015 at 12:30:44PM -0400, Jason Merrill wrote: > >>On 03/11/2015 03:10 PM, Jakub Jelinek wrote: > >>>__has_{cpp_,}attribute builtin macros are effectively function-like macros > >>>taking one argument (and the ISO preprocessor expands macros in the > >>>argument > >>>which is IMHO desirable), but the traditional preprocessor has been > >>>crashing > >>>on them or reporting errors. > >> > >>Why do we want ISO preprocessor behavior in this specific situation? > > > >You mean that we would handle > >#define U unused > >#if __has_attribute(U) > >int u __attribute__((unused)); > >#endif > >differently between ISO and traditional preprocessing? > > >That would be surprising to users. > > Why surprising? Don't users of the traditional preprocessor expect > traditional preprocessor behavior?
Well, but the traditional preprocessor behavior in the end is not in not expanding macro arguments, normally they actually are expanded, but not immediately, but because of trying to preprocess the result of preprocessing again and again. When traditionally preprocessing #if/#elif etc. directives, the directive line is preprocessed until no macros are present and only then fed to the ISO preprocessor to evaluate and handle the directive. The problem with the builtin function-like macros is that it needs the argument immediately. Jakub