Re: C++ preprocessor behaviour change in rawhide

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 10, 2016 at 05:27:46PM +0100, Tomáš Smetana wrote:
> Hello,
>   one of my packages (tvtime) failed to build during the mass rebuild. Not a
> big deal, I think there are several ways to fix it. The odd thing is that the
> build failed due to a rather unexpected change in C++ preprocessor (g++ -E or
> cpp).
> 
> Let's assume I have a test.cpp file containing this:
> 
> #define MYMACRO(a, b) ""a", "b""
> MYMACRO(x,y)
> 
> Now `cpp test.cpp' (or `g++ -E test.cpp') on rawhide produces:

That is expected, and in F23 you get the same behavior if you use
-std=c++11 or -std=c++14.
In C++11 and later the language has user defined literals, so if you just
want to concatenate strings, you need to put a whitespace in between them,
otherwise the preprocessor considers ""a as user defined literal, similarly
for ", "b and that is why it is not macro expanded.
Just use
#define MYMACRO(a, b) "" a ", " b ""

	Jakub
--
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxxx
http://lists.fedoraproject.org/admin/lists/devel@xxxxxxxxxxxxxxxxxxxxxxx




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux