This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: fixinc/inclhack.def (avoid_wchar_t_type): New fix


Bruce Korb wrote:
> 
> Hi Mark,
> 
> Most likely, somebody, somewhere is going to end the wchar_t typedef
> line with an incomplete comment.  The result will be that the
> ``#endif'' will be inside that comment.  I recommend that you delete
> the second `c_fix_arg' and let fixincl default to using the select
> clause.  That will put the comment on the end of the #endif line
> where it will do no harm.  :-)

Oh, also, does the errant file do any testing for __cplusplus being
defined?  If not, then please also add:

  bypass = '#if.*def.*__cplusplus';

so that C++ ready headers are not unnecessarily hacked.
Thanks!

 - Bruce

> +/*
> + *  For C++, avoid any typedef definition of wchar_t,
> + *  and use the built in type instead.
> + */
> +
> +fix = {
> +    hackname = avoid_wchar_t_type;
> +
> +    select    = "^[ \t]*typedef[ \t].*[ \t]wchar_t[ \t]*;";
> +
> +    c_fix     = format;
> +    c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
> + /* c_fix_arg = "^[ \t]*typedef[ \t].*[ \t]wchar_t[ \t]*;.*";  */
> +
> +    test_text = "typedef unsigned short\twchar_t \t; /* wchar_t\n type */";
> +};

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]