Blame test-c/n_13_8.c

Packit Service 8bf002
/* n_13_8.c:    Grouping of sub-expressions in #if expression.  */
Packit Service 8bf002
Packit Service 8bf002
#include    "defs.h"
Packit Service 8bf002
Packit Service 8bf002
main( void)
Packit Service 8bf002
{
Packit Service 8bf002
    fputs( "started\n", stderr);
Packit Service 8bf002
Packit Service 8bf002
/* 13.8:    Unary operators are grouped from right to left. */
Packit Service 8bf002
#if (- -1 != 1) || (!!9 != 1) || (-!+!9 != -1) || (~~1 != 1)
Packit Service 8bf002
    fputs( "Bad grouping of -, +, !, ~ in #if expression.\n", stderr);
Packit Service 8bf002
    exit( 1);
Packit Service 8bf002
#endif
Packit Service 8bf002
Packit Service 8bf002
/* 13.9:    ?: operators are grouped from right to left.    */
Packit Service 8bf002
#if (1 ? 2 ? 3 ? 3 : 2 : 1 : 0) != 3
Packit Service 8bf002
    fputs( "Bad grouping of ? : in #if expression.\n", stderr);
Packit Service 8bf002
    exit( 1);
Packit Service 8bf002
#endif
Packit Service 8bf002
Packit Service 8bf002
/* 13.10:   Other operators are grouped from left to right. */
Packit Service 8bf002
#if (15 >> 2 >> 1 != 1) || (3 << 2 << 1 != 24)
Packit Service 8bf002
    fputs( "Bad grouping of >>, << in #if expression.\n", stderr);
Packit Service 8bf002
    exit( 1);
Packit Service 8bf002
#endif
Packit Service 8bf002
Packit Service 8bf002
/* 13.11:   Test of precedence. */
Packit Service 8bf002
#if 3*10/2 >> !0*2 >> !+!-9 != 1
Packit Service 8bf002
    fputs( "Bad grouping of -, +, !, *, /, >> in #if expression.\n", stderr);
Packit Service 8bf002
    exit( 1);
Packit Service 8bf002
#endif
Packit Service 8bf002
Packit Service 8bf002
/* 13.12:   Overall test.  Grouped as:
Packit Service 8bf002
        ((((((+1 - -1 - ~~1 - -!0) & 6) | ((8 % 9) ^ (-2 * -2))) >> 1) == 7)
Packit Service 8bf002
        ? 7 : 0) != 7
Packit Service 8bf002
    evaluated to FALSE.
Packit Service 8bf002
 */
Packit Service 8bf002
#if (((+1- -1-~~1- -!0&6|8%9^-2*-2)>>1)==7?7:0)!=7
Packit Service 8bf002
    fputs( "Bad arithmetic of #if expression.\n", stderr);
Packit Service 8bf002
    exit( 1);
Packit Service 8bf002
#endif
Packit Service 8bf002
Packit Service 8bf002
    fputs( "success\n", stderr);
Packit Service 8bf002
    return  0;
Packit Service 8bf002
}
Packit Service 8bf002