Bug 2190297

Summary: gap-pkg-cohomolo: Build in C89 mode due to C type errors
Product: [Fedora] Fedora Reporter: Florian Weimer <fweimer>
Component: gap-pkg-cohomoloAssignee: Florian Weimer <fweimer>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: rawhideCC: loganjerry
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: gap-pkg-cohomolo-1.6.11-4.fc39 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-04-27 20:54:52 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2137516    

Description Florian Weimer 2023-04-27 20:37:09 UTC
For example, the variable gap is defined as char in nqpd.c, but referenced in nqp3.c as short:

nqp3.c:6:21: warning: type of ‘gap’ does not match original declaration [-Wlto-type-mismatch]
    6 |     chsdim, chpdim, gap;
      |                     ^
nqd.c:24:72: note: type ‘char’ should match type ‘short int’
   24 |     outf1[80], outf2[80], outfd[80], outcopy[80], act, ch1, crel, cfm, gap;
      |                                                                        ^
nqd.c:24:72: note: ‘gap’ was previously declared here

Redefining exp (of <math.h> fame) as a variable could cause problems as well:

pcp.c:10:31: warning: built-in function ‘exp’ declared as non-function [-Wbuiltin-declaration-mismatch]
   10 | short      npt, np, npt1, nb, exp, prime;
      |                               ^~~

Defining functions as returning short and calling them through an implicit function declaration (which has an implied return type of int) is undefined, too:

pcscfns.c:21:11: warning: type of ‘image’ does not match original declaration [-Wlto-type-mismatch]
   21 |     addsv(image(p[base[i]]), svptr[i]);
      |           ^
permfns.c:53:7: note: return value type mismatch
   53 | short image(short pt)
      |       ^
permfns.c:53:7: note: type ‘short int’ should match type ‘int’
permfns.c:53:7: note: ‘image’ was previously declared here

These are just examples. I suggest to collect all extern declarations in the "defs.h" header, and then make sure that the types match.

Reproducible: Always