Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift iOS 14 Firebase Warning - This Old-Style Function Definition Is Not Preceded By a Prototype

I have an app with Firebase integration to connect analytics using cocoapods. It was working well without any yellow warnings for iOS 13, but when I installed the new cocoa pods for target iOS 14 and build the app I get 6 yellow warning messages

"XXXPods/GoogleUtilities/GoogleUtilities/Logger/GULLogger.m:130:20: This old-style function definition is not preceded by a prototype"

GULLogger.m Warnings

When I was looking for answers online, there are only few and pointing to Flutter. I don't have Flutter for this app and I don't think I will be needing one. Does anyone else have the same issue? How can this be silenced for iOS 14 please?

I can downgrade the pods to iOS 13 but the whole point was to update the version. Thank you for any help/direction

like image 647
Alessign Avatar asked Jun 12 '21 17:06

Alessign


2 Answers

So this is a new warning in Xcode 12.5 (I believe) for old C style functions declared in those SDKs or any old style code using that syntax.


What does it mean?

do-not-leave-the-parameter-list-of-a-function-blank---use-void

if a function declaration does not include arguments, as in double atof();, that too is taken to mean that nothing is to be assumed about the arguments of atof; all parameter checking is turned off. This special meaning of the empty argument list is intended to permit older C programs to compile with new compilers. But it's a bad idea to use it with new programs. If the function takes arguments, declare them; if it takes no arguments, use void.

So this is how your function prototype should look:

int foo(void);

And this is how the function definition should be:

int foo(void)
{
    ...
    <statements>
    ...
    return 1;
}

One advantage of using the above, over int foo() type of declaration (ie. without using the keyword void), is that the compiler can detect the error if you call your function using an erroneous statement like foo(42). This kind of a function call statement would not cause any errors if you leave the parameter list blank. The error would pass silently, undetected and the code would still execute.


What can we do?

May be raise a ticket for Firebase SDK to address (if there is not one already).


How big of a problem is this?

Depends on the implementation details. Could be as simple as replacing () with (void) for all of these functions. Could be a little more involved as explained above otherwise.


Firebase team maintains the SDKs regularly and we should see a fix for this in an upcoming release soon.

like image 119
Tarun Tyagi Avatar answered Oct 14 '22 03:10

Tarun Tyagi


Run pod update

Firebase fixed this issue in February after Xcode 12.5 was introduced github.com/google/GoogleUtilities/pull/8/files.

like image 33
Paul Beusterien Avatar answered Oct 14 '22 02:10

Paul Beusterien