42School / norminette

Official 42 norminette
MIT License
956 stars 140 forks source link

Infinite loop when return type not specified #438

Open QuiteHollow opened 1 year ago

QuiteHollow commented 1 year ago

Describe the bug Norminette goes into an infinite loop

Erroneous code

some_function_without_a_return_type()
{
}

Additional infos

Additional context When using a norminette highlighter in VSCode together with autosave this really becomes an issue, because a lot of norminette processes get started that never finish and this will slow down the computer to a halt.

matthieu42Network commented 1 year ago

Hello, please keep in mind that norminette has undefined behavior with code that doesn't compile.

QuiteHollow commented 1 year ago

This also causes norm to go into an infinite loop, and compiles fine with gcc -Wall -Wextra -Werror. Yes, I am aware that this is not normal code, but it is valid and it causes the same problem I mentioned before. It would be fine if it crashed norminette, but if it causes an infinite loop, this will break any application relying on norminette, such as the VSCode highlighter.

#include <stdio.h>

#define A() void

void break_it();

int main(int argc, char **argv)
{
    break_it();
    printf("argc: %d, argv[0]: %s\n", argc, argv[0]);
    return (0);
}

A()
break_it()
{
}