Closed Bug 858897 Opened 11 years ago Closed 11 years ago

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

Categories

(Core :: Internationalization, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla23

People

(Reporter: joel.s.williamson, Assigned: joel.s.williamson)

Details

Attachments

(1 file, 1 obsolete file)

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.
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+
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
https://hg.mozilla.org/mozilla-central/rev/89d55e49bc7a
Status: UNCONFIRMED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla23
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: