Greetings,

On 1/11/11, narendra babu <[email protected]> wrote:
> Hello folks ,
>
> I have 200+ legacy c code  which were compiled using c89/c99 compilers, i am
> planning to move/migrate using latest compilers  and migrate to 64 bit env ,
> doing so i could able to fix compiler errors/warnings   for 32bit-ILP bit to
> 64bit-LP bit env  .
>
>
> Some warnings i found is as mentioned below :
>
> 1 ) almost all programs are having  return type as void for main , and
> current compiler throws warning that  main should return int , i need to
> change each and every file converting return type of main from void to int
> and end of main i need to add one more statement return 0;  for OS .

Trivial, I guess,

>From http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html:

-Wignored-qualifiers (C and C++ only)
    Warn if the return type of a function has a type qualifier such as
const. For ISO C such a type qualifier has no effect, since the value
returned by a function is not an lvalue. For C++, the warning is only
emitted for scalar types or void. ISO C prohibits qualified void
return types on function definitions, so such return types always
receive a warning even without this option.

    This warning is also enabled by -Wextra.

>
> Now i would like to know is there anyway i can do that in command line of
> compiler where i can make all my c programs return (0) at the end of the
> main and return int for main .
>
>
> 2) Also is there any way i can get only one kind of warnings using option in
> command line of compiler  so that i can list which files are impacted  for a
> particular warning rather than all warnings , as i am compiling all the  c
> programs at one go .
>
>
> i could not get any help from searching the web , just i want avoid the
> manual work as there are lot of c programs and It can save a lot of time
>
>
> Thanks for your inputs in advance
>


and tonnes.. of them options in GNU Compiler collections.

Check out preprocessors

Maybe bison/flex later.... and lint perhaps

HTH

Regards,

Rajagopal
_______________________________________________
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc

Reply via email to