8000 Corrode has trouble with "implicit ints" in K&R style · Issue #169 · jameysharp/corrode · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Corrode has trouble with "implicit ints" in K&R style #169
Open
@jhwgh1968

Description

@jhwgh1968

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0