Last Comment Bug 858897 - intl/uconv/tools/umaptable.c is full of errors
: intl/uconv/tools/umaptable.c is full of errors
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Internationalization (show other bugs)
: Trunk
: x86_64 Linux
: -- normal (vote)
: mozilla23
Assigned To: Joel Williamson
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-04-06 01:19 PDT by Joel Williamson
Modified: 2013-04-22 19:21 PDT (History)
1 user (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Minor edits to allow compilation with no warnings. (2.07 KB, patch)
2013-04-06 02:43 PDT, Joel Williamson
smontagu: review+
Details | Diff | Splinter Review
Fix warnings in umaptable.c (2.21 KB, patch)
2013-04-08 12:07 PDT, Joel Williamson
no flags Details | Diff | Splinter Review

Description Joel Williamson 2013-04-06 01:19:35 PDT
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.
Comment 1 Joel Williamson 2013-04-06 02:43:36 PDT
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.
Comment 2 Simon Montagu :smontagu 2013-04-08 10:33:05 PDT
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)
Comment 3 Joel Williamson 2013-04-08 12:07:07 PDT
Created attachment 734764 [details] [diff] [review]
Fix warnings in umaptable.c

Added MQ style header.
Comment 4 David Baron :dbaron: ⌚️UTC+2 (mostly busy through August 4; review requests must explain patch) 2013-04-22 04:10:36 PDT
checkin+ means "has been checked in".  I think you want checkin-needed.
Comment 5 Ryan VanderMeulen [:RyanVM] 2013-04-22 05:40:20 PDT
https://hg.mozilla.org/integration/mozilla-inbound/rev/89d55e49bc7a
Comment 6 Wes Kocher (:KWierso) 2013-04-22 19:21:05 PDT
https://hg.mozilla.org/mozilla-central/rev/89d55e49bc7a

Note You need to log in before you can comment on or make changes to this bug.