Operating System - HP-UX
1831939 Members
3436 Online
110032 Solutions
New Discussion

Re: Pro*C Precompile Warnings in HPUX Itanium

 
victorq
New Member

Pro*C Precompile Warnings in HPUX Itanium

Hi,

I migrated from HP-UX versión 11.11 RICS to HP-UX versión 11.31 Itanium.

The Proc un 11.11 RICS Compile fine, but when recompiling in 11.31 Itanium generate warnings such a :
- warning #2951-D: return type of function "main" must be "int"
- warning #2181-D: argument is incompatible with corresponding format string conversion
etc

Help me please how to solve the problem.

Thanks

Mnauel
12 REPLIES 12
Dennis Handly
Acclaimed Contributor

Re: Pro*C Precompile Warnings in HPUX Itanium

The warnings mean what they say, your code is broken. Look at what you have for the definition of main. I should not be "void main" but "int main".
The format error means you have the wrong format for that argument.
To help you any more, we would need to see the exact warning and the source in question.
victorq
New Member

Re: Pro*C Precompile Warnings in HPUX Itanium

Hi,

Ok, thanks for replay.

the question is because in HP-UX versión 11.11 RICS the programs .pc compile well without warnings, whereas in the HP-UX versión 11.31 Itanium the same programs generate warnings ..?

is It some flag of compiled ..?

Thanks
victorq
New Member

Re: Pro*C Precompile Warnings in HPUX Itanium

Hi,

This is a example the .pc :

#include
#include
#include
#include
#include

void main( argc, argv )
int argc;
char **argv;
{
if( argc != 3 ) {
FinAnormal(0);
}

if( !ValidarUsuario( argv[2] ) ) {
FinAnormal(1);
}

ProcesarArchivo( argv[1] );
}


void FinAnormal( CodigoError )
int CodigoError;
{
fprintf( stderr, "%s\n", ListaErrores[CodigoError] );
exit( CodigoError );
}


In 11.11 RISC the .C is generated without warnings
In 11.31 Itanium the .C is generated with warnings

Thanks
Steven Schweda
Honored Contributor

Re: Pro*C Precompile Warnings in HPUX Itanium

> [...] the same programs generate warnings ..?

You're using two different compilers, and one
is newer/better/more helpful.

> warning #2951-D: return type of function
> "main" must be "int"

> void main( argc, argv )

That seems pretty clear to me.

> warning #2181-D: argument is incompatible
> with corresponding format string conversion
> etc

Not knowing which line is involved, I'll
assume this one:

> fprintf( stderr, "%s\n", ListaErrores[CodigoError] );

I don't see a declaration of ListaErrores[].
Is it "char *" (to agree with "%s")?
rick jones
Honored Contributor

Re: Pro*C Precompile Warnings in HPUX Itanium

Differnet compilers notice and/or care about different things.

Clearly in this case the compiler you are using on 11.31 (BTW, you should specify the compiler version, not the OS version) cares about things the compiler version you are using on the system running 11.11 does not. Perhaps the compiler on 11.11 adheres to a looser/older C standard.

You should solve the problem by fixing your source code. I suspect you will find it still compiles without incident with the compiler you use on 11.11. Don't try to paper-over the warnings with compiler options even if you find some. At least that is my personal suggestion.
there is no rest for the wicked yet the virtuous have no pillows
Dennis Handly
Acclaimed Contributor

Re: Pro*C Precompile Warnings in HPUX Itanium

>the question is because in HP-UX 11.11 RISC the programs .pc compile well without warnings, whereas in the HP-UX 11.31 Integrity the same programs generate warnings?

Because aCC6 is much better (and stricter) than the PA compiler. It also includes +wlint.

>void main(argc, argv) int argc; char **argv;

This is garbage K&R style code. Also the Standard requires main to return an int.

>fprintf(stderr, "%s\n", ListaErrores[CodigoError]);

What is the type of ListaErrores? Is it a char[]? A char*?

>Rick: Perhaps the compiler on 11.11 adheres to a looser/older C standard.

They are probably both C89 but aCC6 is just better at flagging errors.
victorq
New Member

Re: Pro*C Precompile Warnings in HPUX Itanium

Ok,

I understand that the new version is more strict that the previous version and the solution is to check the code to solve it.

The problem is the .C are many programas and to solve each one would spend a lot of time.

I might restore Compiler C of RISC version and use it in Itanium ..?

Thanks
Steven Schweda
Honored Contributor

Re: Pro*C Precompile Warnings in HPUX Itanium

> I might restore Compiler C of RISC version
> and use it in Itanium ..?

Right. Good one.

Or, if you were serious, I seriously doubt it.
rick jones
Honored Contributor

Re: Pro*C Precompile Warnings in HPUX Itanium

The compiler you are running on the 11.31 Itanium system is pointing-out probable bugs in the source code. Probable bugs that the older compiler didn't catch. Just because the older compiler didn't catch them doesn't mean the code was correct, it only means that the older compiler didn't catch them. Soooooo, you Really Should (tm) start cleaning-up the warnings.

The compiler you are running on the 11.11 system only generates PA-RISC code. While the Aries emulator will run that code on the Itanium systems, you are better off running "native" Itanium code. For that reason, bringing the compiler you are using on the 11.11 system onto the 11.31 Itanium system is really not a good idea.
there is no rest for the wicked yet the virtuous have no pillows
James R. Ferguson
Acclaimed Contributor

Re: Pro*C Precompile Warnings in HPUX Itanium

Hi:

To Rick's sound advice, I'll add a question for you: What will you do when a later compiler version doesn't compile your old code at all? Won't you wish that you had taken the time to address the *warnings* that have now become outright *errors*? You see, the issue will resurface and at a time when you have less time than now to rectify it. That's a universal law :-)

Of course, you could hope that all this will simply become someone else's problem.

Regards!

...JRF...

Regards!

...JRF...

Dennis Handly
Acclaimed Contributor

Re: Pro*C Precompile Warnings in HPUX Itanium

>the solution is to check the code to solve it.
>The problem is the .C are many programs and to solve each one would spend a lot of time.

If you don't want to fix them now, you can just ignore the warnings until you have some time to fix them.

You can also use HP Code Advisor to get a prioritized list of the warnings so you know which to work on first:
$ cadvise report logfiles ...
Steven Schweda
Honored Contributor

Re: Pro*C Precompile Warnings in HPUX Itanium

> The problem is the .C are many programas
> and to solve each one would spend a lot of
> time.

Writing good, clean code is such a bother.
This fact helps to explain the abundance of
bad code in the world.