[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
error: implicit declaration of function 'dap_main' is invalid in C99
From: |
Ryan Schmidt |
Subject: |
error: implicit declaration of function 'dap_main' is invalid in C99 |
Date: |
Wed, 6 Jan 2021 09:07:36 -0600 |
Hi, I'm a developer with MacPorts where we have a port for dap 3.10, but it
does not build on macOS with the version of clang included with Xcode 12 or
later. The errors are:
dap0.c:241:3: error: implicit declaration of function 'dap_main' is invalid in
C99 [-Werror,-Wimplicit-function-declaration]
ps1.c:904:29: error: implicit declaration of function 'dap_il' is invalid in
C99 [-Werror,-Wimplicit-function-declaration]
ps1.c:905:29: error: implicit declaration of function 'dap_sl' is invalid in
C99 [-Werror,-Wimplicit-function-declaration]
ps1.c:906:30: error: implicit declaration of function 'dap_dl' is invalid in
C99 [-Werror,-Wimplicit-function-declaration]
sbstrans.c:214:7: error: implicit declaration of function 'unget1c' is invalid
in C99 [-Werror,-Wimplicit-function-declaration]
sbstrans.c:1268:5: error: implicit declaration of function 'importtrans' is
invalid in C99 [-Werror,-Wimplicit-function-declaration]
sbstrans.c:1270:5: error: implicit declaration of function 'surveyselecttrans'
is invalid in C99 [-Werror,-Wimplicit-function-declaration]
This was reported to MacPorts here:
https://trac.macports.org/ticket/61965
Apple deliberately changed implicit declaration of functions from a warning to
an error in Xcode 12 because Apple introduced Macs using ARM processors. ARM
processors use different calling conventions for variadic and non-variadic
functions so the compiler must know before you call a function what kind of
function it is. Prior to this becoming an error, if it did not know, it would
guess, and if it guessed wrong, your program would crash.
Your INSTALL file even mentions that this problem will occur:
> Note: when DAP_HOME/src/dap.c
> compiles, you will get a warning:
>
> implicit declaration of function `strcat'
>
> and when DAP_HOME/src/dap0.c compiles, you will get a warning:
>
> implicit declaration of function `dap_main'
>
> Ignore these warnings.
Now that in Xcode 12 these are errors, not warnings, they cannot be ignored.
I am not familiar with dap, but the attached patch is what I have committed to
MacPorts to address this problem. Hopefully you will agree that this was the
correct fix and you can commit it to your repository. I'm also attaching my
attempt at updating the INSTALL file for this and some other changes.
implicit.patch
Description: Binary data
INSTALL.patch
Description: Binary data
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- error: implicit declaration of function 'dap_main' is invalid in C99,
Ryan Schmidt <=