c - How to concatenate strings in the arguments of _Pragma -
the argument of _pragma string think when paste strings in normal c-preprocessor way (ie putting them right next eachother) form new string argument of _pragma. however
_pragma("gcc poison " "puts") fails error
error: _pragma takes parenthesized string literal how can circumvented?
this particular example isn't useful , has trivial solution of making them 1 string begin with, end goal stringize macro it
the do_pragma macro in gnu docs defined this
#define do_pragma(x) _pragma (#x) using this, if put 2 seperate token unstringized next eachother, become stringized. expand macros within definition, must go through 1 level of indirection, define as
#define do_pragma_(x) _pragma (#x) #define do_pragma(x) do_pragma_(x) using can create shorthands various pragmas this
#define poison(name) do_pragma(gcc poison name) poision(puts)//becomse _pragma("gcc poison puts") thanks eugene sh. pointing me do_pragma macro
Comments
Post a Comment