Take the following testcase: #include <altivec.h> #define xprint_vec(type) void x##type(vector type v) { } xprint_vec(float); This used to work in 4.3 and before but does not currently. The problem here was introduced when the context sensitive keyword support was added.
Created attachment 15990 [details] gcc44-pr36904.patch Partial fix, which fixes the testcase from this PR, but still other cases in the made up testcase fail and I don't know if they are meant to work or not.
Subject: Re: [4.4 Regression] vector context sensitive keyword vs macros > Partial fix, which fixes the testcase from this PR, but still other cases > in the made up testcase fail and I don't know if they are meant to > work or not. If it does not make things worse, should we apply this patch? Ben
Created attachment 16179 [details] gcc44-pr36904.patch Updated patch, apparently all other problems can be fixed just by never expanding the conditional keywords to self. This will make preprocessing them tiny bit slower (as the macro_to_expand hook might be called several times on it), but means we handle right even the cases where cpp_get_token is called with a conditional macro token in some inner context where following tokens aren't seen yet (e.g. macro args, etc.). I don't have any altivec.h codebase around, could one of you test this on something larger? Thanks.
Subject: Bug 36904 Author: jakub Date: Wed Sep 10 21:06:25 2008 New Revision: 140247 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=140247 Log: PR target/36904 * config/rs6000/rs6000-c.c (rs6000_macro_to_expand): Return NULL instead of tok->val.node if not expanding to something else. Handle intervening CPP_PADDING tokens. (altivec_categorize_keyword): Remove unneeded comparisons. * gcc.target/powerpc/altivec-27.c: New test. Added: trunk/gcc/testsuite/gcc.target/powerpc/altivec-27.c Modified: trunk/gcc/ChangeLog trunk/gcc/config/rs6000/rs6000-c.c trunk/gcc/testsuite/ChangeLog
Fixed.