Open
Description
I guess this is what I get for trying to modernise C code that turned 25 this year. 😄
$ cat test_pass.c
#include <stdio.h>
int
main(argc, argv)
int argc;
char **argv;
{
printf("Hello world!\n");
return 0;
}
$ corrode test_pass.c
<command-line>:0:1: warning: undefining "__LINE__"
test_pass.rs
test_pass.o
$ cat test_fail.c
#include <stdio.h>
int
main(argc, argv)
char **argv; // argc is implicitly type int
{
printf("Hello world!\n");
return 0;
}
$ corrode test_fail.c
<command-line>:0:1: warning: undefining "__LINE__"
("test_fail.c": line 4): illegal undeclared argument "argc"; check whether a real C compiler accepts this:
main(argc, argv)
$ gcc -c test_fail.c
test_fail.c: In function ‘main’:
test_fail.c:4:1: warning: type of ‘argc’ defaults to ‘int’ [-Wimplicit-int]
main(argc, argv)
^~~~
While this example may seem simple, are a lot of register foo
declarations scattered throughout the code, as well as some number of function extern definitions that are weird (that I may open a separate issue for if I can better characterize it).
Maybe this is easy to fix?
Metadata
Metadata
Assignees
Labels
No labels