ltcmelo / psychec

A compiler frontend for the C programming language
BSD 3-Clause "New" or "Revised" License
536 stars 39 forks source link

`__complex__` unsupported #34

Closed aytey closed 2 years ago

aytey commented 3 years ago

GCC version:

gcc (SUSE Linux) 10.2.1 20201202 [revision e563687cf9d3d1278f45aaebd03e0f66531076c9]

clang version:

clang version 11.0.1

Output of gcc -Werror -Wall -Wextra -Wpedantic -pedantic -std=c11 -c $FNAME

(return code 0)

Output of clang -Werror -Wall -Wextra -Wpedantic -pedantic -std=c11 -c $FNAME

(return code 0)

Output of cnip $FNAME

complex.c:0:0 warning: missing type specifier, assume `int'complex.c:0:12 error: expected `,' or `;' or `=' after declarator, got `float'
__complex__ float foo;
            ^

(return code 0)

Content of file

__complex__ float foo;

psychec version

commit d10dc1ddfb7ea845f59274a4d6ca5d021ab31423
Author: Leandro T. C. Melo <LTCMELO@GMAIL.COM>
Date:   Tue Mar 9 21:18:30 2021 -0300

    fix postfixing on compound literal
aytey commented 3 years ago

Very similar:

GCC version:

gcc (SUSE Linux) 10.2.1 20201202 [revision e563687cf9d3d1278f45aaebd03e0f66531076c9]

clang version:

clang version 11.0.1

Output of gcc -Werror -Wall -Wextra -Wpedantic -pedantic -std=c11 -c $FNAME

(return code 0)

Output of clang -Werror -Wall -Wextra -Wpedantic -pedantic -std=c11 -c $FNAME

(return code 0)

Output of cnip $FNAME

imag.c:3:17 error: expected `;', got `x'
  (void)__imag__ x;
                 ^

(return code 0)

Content of file

void foo(void) {
  float x = 0;
  (void)x;
  (void)__imag__ x;
}

psychec version

commit ca31d32becabd3abf70fc8c82a86f4f57d1b6323
Author: Leandro T. C. Melo <LTCMELO@GMAIL.COM>
Date:   Sat Mar 13 14:56:40 2021 -0300

    disable certain lang. extensions by default
aytey commented 3 years ago

Same for __real__:

GCC version:

gcc (SUSE Linux) 10.2.1 20201202 [revision e563687cf9d3d1278f45aaebd03e0f66531076c9]

clang version:

clang version 11.0.1

Output of gcc -Werror -Wall -Wextra -Wpedantic -pedantic -std=c11 -c $FNAME

(return code 0)

Output of clang -Werror -Wall -Wextra -Wpedantic -pedantic -std=c11 -c $FNAME

(return code 0)

Output of cnip $FNAME

real.c:3:17 error: expected `;', got `x'
  (void)__real__ x;
                 ^

(return code 0)

Content of file

void foo(void) {
  float x = 0;
  (void)x;
  (void)__real__ x;
}

psychec version

commit ca31d32becabd3abf70fc8c82a86f4f57d1b6323
Author: Leandro T. C. Melo <LTCMELO@GMAIL.COM>
Date:   Sat Mar 13 14:56:40 2021 -0300

    disable certain lang. extensions by default
ltcmelo commented 3 years ago

These are extensions. I just created a label for this kind of errors.

ltcmelo commented 2 years ago

Fixed by https://github.com/ltcmelo/psychec/pull/86