ARM gdb compilation fails with implicit function declaration error ioctl

Ryan Schmidt ryandesign at macports.org
Mon Dec 28 23:13:59 UTC 2020


Don't forget to Reply All so the conversation stays on the list.

On Dec 26, 2020, at 05:06, Christoph Kukulies wrote:

> There were times in history where implicit function declarations  were not considered as an error (consulting my book „The C programming language by Kernighan/Ritchie“
> and my question actually aimed at that, like making the compiler a bit more tolerant.
> 
> I would consider it difficult to get my problem quickly solved when reporting to the author(s) of gnu readline that their code is in error.

Yes, there was such a time, prior to the introduction of the C99 standard 21 years ago.

These days, implicit function declarations are not allowed. Developers must declare functions or their prototypes before using them. This requirement should not be controversial.

Apple turned this warning into an error in Xcode 12 because of the introduction of Macs using Apple Silicon. ARM uses different machine code for calling a function depending on whether the function takes a variable or fixed number of arguments. The compiler needs to know, via the function declaration or prototype, what type of function it is before you call it. Otherwise it has to guess, and if it guesses wrong, the program will crash at runtime.

For you own debugging on your own system, you can temporarily suppress the error and turn it back into a warning by adding -Wno-error=implicit-function-declaration to CFLAGS. Do not do this on Apple Silicon machines, don't commit this to other projects, don't commit this to MacPorts.



More information about the macports-users mailing list