intl/uconv/tools/umaptable.c is full of errors

RESOLVED FIXED in mozilla23

Status

()

Core
Internationalization
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: Joel Williamson, Assigned: Joel Williamson)

Tracking

Trunk
mozilla23
x86_64
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

4 years ago
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:23.0) Gecko/20130404 Firefox/23.0
Build ID: 20130404030859

Steps to reproduce:

Attempted to compile intl/uconv/tools/umaptable.c with gcc -Werror=return-type


Actual results:

Compile failed as several functions don't have return types, built-in functions strncmp and exit are called without including the proper libraries.

umaptable.c:358:1: error: return type defaults to ‘int’ [-Werror=return-type]
 parsearg(int argc, char* argv[])
 ^
umaptable.c: In function ‘parsearg’:
umaptable.c:363:3: warning: implicit declaration of function ‘strncmp’ [-Wimplicit-function-declaration]
   if(strncmp("-uf", argv[i],3) == 0) {
   ^
umaptable.c:369:28: warning: implicit declaration of function ‘exit’ [-Wimplicit-function-declaration]
                            exit(-1);
                            ^
umaptable.c:369:28: warning: incompatible implicit declaration of built-in function ‘exit’ [enabled by default]
umaptable.c:378:28: warning: incompatible implicit declaration of built-in function ‘exit’ [enabled by default]
                            exit(-1);
                            ^
umaptable.c:394:5: warning: incompatible implicit declaration of built-in function ‘exit’ [enabled by default]
     exit(-1);
     ^
umaptable.c:411:5: warning: incompatible implicit declaration of built-in function ‘exit’ [enabled by default]
     exit(-1);
     ^
umaptable.c:419:3: warning: incompatible implicit declaration of built-in function ‘exit’ [enabled by default]
   exit(-1);
   ^
umaptable.c: In function ‘getinput’:
umaptable.c:430:3: warning: ‘gets’ is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations]
   for (; gets(buf);)
   ^
umaptable.c: At top level:
umaptable.c:442:1: error: return type defaults to ‘int’ [-Werror=return-type]
 main(int argc, char* argv[])
 ^
umaptable.c: In function ‘parsearg’:
umaptable.c:425:1: error: control reaches end of non-void function [-Werror=return-type]
 }
 ^
umaptable.c: In function ‘main’:
umaptable.c:449:1: error: control reaches end of non-void function [-Werror=return-type]
 }
 ^
cc1: some warnings being treated as errors



Expected results:

Compile succeeded.
(Assignee)

Comment 1

4 years ago
Created attachment 734215 [details] [diff] [review]
Minor edits to allow compilation with no warnings.

I tidied up the return types and #includes, and switched from deprecated gets to fgets. I would have added a test, but I'm not sure how to write a test for a C program that does I/O.
Attachment #734215 - Flags: review?(smontagu)
Comment on attachment 734215 [details] [diff] [review]
Minor edits to allow compilation with no warnings.

Review of attachment 734215 [details] [diff] [review]:
-----------------------------------------------------------------

r=me (I don't know if we will ever need to use this tool again, but cleanup is always good)
Attachment #734215 - Flags: review?(smontagu) → review+
(Assignee)

Comment 3

4 years ago
Created attachment 734764 [details] [diff] [review]
Fix warnings in umaptable.c

Added MQ style header.
Attachment #734215 - Attachment is obsolete: true
Attachment #734764 - Flags: checkin+
checkin+ means "has been checked in".  I think you want checkin-needed.
Keywords: checkin-needed
Attachment #734764 - Flags: checkin+
https://hg.mozilla.org/integration/mozilla-inbound/rev/89d55e49bc7a
Assignee: nobody → joel.s.williamson
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/89d55e49bc7a
Status: UNCONFIRMED → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla23
You need to log in before you can comment on or make changes to this bug.