__VA__ARGS__ substitution problem with Intel 13.0 Update 1

__VA__ARGS__ substitution problem with Intel 13.0 Update 1

Bild des Benutzers Bernhard B.

Hello,

with Intel(R) Composer XE 2013 Update 1 (package 119) the behaviour of the preprocessor with __VA_ARGS__ has changed unter Windows (Visual Studio 2010 mode).
It seems that the __VA_ARGS__ arguments are inserted now as one argument although they are seperated by commas. Therefore the following preprocessor commands behave differently with the new version as before with Intel Composer XE 2011 Update 13 (package 371). 

#define BOOST_PP_VARIADICS_MSVC 1
#define BOOST_PP_VARIADICS
#include <boost/preprocessor/variadic/size.hpp>
#define ENUMTEXT_ARGUMENT(xxx) { xxx , #xxx }
#define ENUMTEXT_A1(xxx) ENUMTEXT_ARGUMENT(xxx)
#define ENUMTEXT_A2(xxx, ...) ENUMTEXT_ARGUMENT(xxx), BOOST_PP_CAT(ENUMTEXT_A, BOOST_PP_VARIADIC_SIZE(__VA_ARGS__))( __VA_ARGS__ )
#define ENUMTEXT_LIST(...) BOOST_PP_CAT(ENUMTEXT_A, BOOST_PP_VARIADIC_SIZE(__VA_ARGS__))(__VA_ARGS__)
#define ENUMTEXT(xxx) ENUMTEXT_LIST(xxx)
ENUMTEXT_LIST(Test, Test2)

I used the following command to compile it: icl /Qms0 /P meow.cpp /IF:\Libs\boost_1_50_0 

It generates the output:

#line 1 "meow.cpp"
#line 1 "F:\Libs\boost_1_50_0\boost/preprocessor/variadic/size.hpp"
#line 1 "F:\Libs\boost_1_50_0\boost/preprocessor/cat.hpp"
#line 1 "F:\Libs\boost_1_50_0\boost/preprocessor/config/config.hpp"
#line 18 "F:\Libs\boost_1_50_0\boost/preprocessor/cat.hpp"
#line 17 "F:\Libs\boost_1_50_0\boost/preprocessor/variadic/size.hpp"
#line 1 "F:\Libs\boost_1_50_0\boost/preprocessor/config/config.hpp"
#line 18 "F:\Libs\boost_1_50_0\boost/preprocessor/variadic/size.hpp"
#line 4 "meow.cpp"
{ Test, Test2 , "Test, Test2" }, { , }

Before it was:

{ Test , "Test" }, { Test2 , "Test2" }

Is the new behaviour the corret one?
Thanks in advance.

3 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.
Bild des Benutzers Judith Ward (Intel)

If it matches the Microsoft compiler then it it correct.

I believe that this is the relevant desription of the change:

Microsoft compatibility: commas in macro arguments

The Microsoft preprocessor gives special treatment to commas appearing in
the substituted text of macro arguments: if that text appears as a macro
argument when rescanned for further expansion, such commas do not delimit
macro arguments. The front end has now been modified to emulate this behavior. For example:

#define M1(a) M2(a)
#define M2(a) a
#define XY x,y
M1(XY) // Formerly warned of "too many arguments" and expanded to "x"
// Now expands to "x,y" with no warning

Bild des Benutzers Judith Ward (Intel)

This change was necesary in order to be able to compile almost any of the C++ standard library headers that are supplied with MSVC++ 2012 so changing the behaviour under /Qms0 to be non Microsoft compatible would probably render that switch useless.

Melden Sie sich an, um einen Kommentar zu hinterlassen.