42School / norminette

Official 42 norminette
MIT License
956 stars 140 forks source link

Multiple defined in the same line #499

Open Qpupier opened 4 months ago

Qpupier commented 4 months ago

Description Multiple defined in the same line creates an error.

Erroneous code

if (defined(__linux__) && defined(__amd64__))

This return Unexpected tokens after the constant expression and the rest of the file is not checked.

Additional infos norminette 3.3.55

NiumXp commented 4 months ago

Hello, @Qpupier!

I was unable to replicate your bug in the version you showed and in the latest version.

Latest version (if you git clone norminette):

(.venv) niumxp@DESKTOP-LRN507C:~/oss/norminette$ cat test.c
int     main(void)
{
        if (defined(__linux__) && defined(__amd64__))
                return (1);
        return (0);
}
(.venv) niumxp@DESKTOP-LRN507C:~/oss/norminette$ norminette test.c
test.c: Error!
Error: INVALID_HEADER       (line:   1, col:   1):      Missing or invalid 42 header
(.venv) niumxp@DESKTOP-LRN507C:~/oss/norminette$ norminette --version
norminette3.3.55, Python 3.10.12, Linux-5.15.153.1-microsoft-standard-WSL2-x86_64-with-glibc2.35

Your version is the commit 7de5543e6e7b5f558d2ee5d1189a3d9c139621f2:

(.venv) niumxp@DESKTOP-LRN507C:~/oss/norminette$ git checkout 7de5543e6e7b5f558d2ee5d1189a3d9c139621f2
Note: switching to '7de5543e6e7b5f558d2ee5d1189a3d9c139621f2'.

[...]
(.venv) niumxp@DESKTOP-LRN507C:~/oss/norminette$ norminette --version
norminette 3.3.55
(.venv) niumxp@DESKTOP-LRN507C:~/oss/norminette$ norminette test.c
test.c: Error!
Error: INVALID_HEADER       (line:   1, col:   1):      Missing or invalid 42 header