Open Bug 1102981 Opened 5 years ago

secutil.c:2706:11: warning: incompatible pointer types passing 'int (FILE *, const SECItem *, const char *, int)' to parameter of type 'SECU_PPFunc' (aka 'int (*)(FILE *, SECItem *, char *, int)') [-Wincompatible-pointer-types] (for SECU_PrintCertificate)

Categories

(NSS :: Libraries, defect)

defect
Not set

Tracking

(Not tracked)

People

(Reporter: dholbert, Unassigned)

References

(Blocks 1 open bug)

Details

I get this build warning when compiling mozilla-central, with clang:
{
secutil.c:2706:11: warning: incompatible pointer types passing 'int (FILE *, const SECItem *, const char *, int)' to parameter of type 'SECU_PPFunc' (aka 'int (*)(FILE *, SECItem *, char *, int)') [-Wincompatible-pointer-types]
                                      SECU_PrintCertificate);
                                      ^~~~~~~~~~~~~~~~~~~~~
./secutil.h:261:56: note: passing argument to parameter 'inner' here
                                int level, SECU_PPFunc inner);
                                                       ^
}

(I also get two more copies of the warning, for two other instances where we pass SECU_PrintCertificate as an argument later down in this file)

This is because SECU_PrintCertificate's prototype doesn't match the typedef for "SECU_PPFunc", ever since bug 854729 added a "const" label to some of its args:
https://hg.mozilla.org/projects/nss/diff/9639e5f328c9/cmd/lib/secutil.c#l1.318

We need to drop the "const" label from SECU_PrintCertificate's args to fix this.  Or alternately we could change SECU_PPFunc and every other function that's passed as a SECU_PPFunc -- but that's probably less-feasible.
You need to log in before you can comment on or make changes to this bug.