Description: avoid if preprocessor when macro contains a cast Version 5.9+20140118 embeds an explicit cast to chtype inside macros like A_STANDOUT. The GCC preprocessor does not recognize the chtype identifier and replaces it with 0, making the test fail with an error message. . Upstream will decide if curses.h should be reverted or this patch permanently applied to gen.c. Bug-Debian: http://bugs.debian.org/735753 Forwarded: http://lists.gnu.org/archive/html/bug-ncurses/2014-01/msg00003.html Author: Nicolas Boulenguez --- a/gen/gen.c +++ b/gen/gen.c @@ -116,6 +116,7 @@ * record type defined in the binding. * We are only dealing with record types which are of 32 or 16 * bit size, i.e. they fit into an (u)int or a (u)short. + * Any pair with a 0 attr field will be ignored. */ static void gen_reps( @@ -132,6 +133,7 @@ assert(nap != NULL); for (i = 0; nap[i].name != (char *)0; i++) + if (nap[i].attr) { l = (int)strlen(nap[i].name); if (l > width) @@ -142,6 +144,7 @@ printf(" type %s is\n", name); printf(" record\n"); for (i = 0; nap[i].name != (char *)0; i++) + if (nap[i].attr) { printf(" %-*s : Boolean;\n", width, nap[i].name); } @@ -152,6 +155,7 @@ printf(" record\n"); for (i = 0; nap[i].name != (char *)0; i++) + if (nap[i].attr) { a = nap[i].attr; l = find_pos((char *)&a, sizeof(a), &low, &high); @@ -243,54 +247,26 @@ * 1999-2000), the ifdef's also were needed since the proposed bit-layout * for wide characters allocated 16-bits for A_CHARTEXT, leaving too few * bits for a few of the A_xxx symbols. + * Some preprocessors are not able to test the values because they + * now (2014) contain an explicit cast to chtype, so we avoid ifdef. */ static const name_attribute_pair nap[] = { -#if A_STANDOUT {"Stand_Out", A_STANDOUT}, -#endif -#if A_UNDERLINE {"Under_Line", A_UNDERLINE}, -#endif -#if A_REVERSE {"Reverse_Video", A_REVERSE}, -#endif -#if A_BLINK {"Blink", A_BLINK}, -#endif -#if A_DIM {"Dim_Character", A_DIM}, -#endif -#if A_BOLD {"Bold_Character", A_BOLD}, -#endif -#if A_ALTCHARSET {"Alternate_Character_Set", A_ALTCHARSET}, -#endif -#if A_INVIS {"Invisible_Character", A_INVIS}, -#endif -#if A_PROTECT {"Protected_Character", A_PROTECT}, -#endif -#if A_HORIZONTAL {"Horizontal", A_HORIZONTAL}, -#endif -#if A_LEFT {"Left", A_LEFT}, -#endif -#if A_LOW {"Low", A_LOW}, -#endif -#if A_RIGHT {"Right", A_RIGHT}, -#endif -#if A_TOP {"Top", A_TOP}, -#endif -#if A_VERTICAL {"Vertical", A_VERTICAL}, -#endif {(char *)0, 0} }; chtype attr = A_ATTRIBUTES & ~A_COLOR;