1833270 Members
3209 Online
110051 Solutions
New Discussion

Re: acc compile warning

 
Wendy_4
Frequent Advisor

acc compile warning

Hi,
We upgrate HP-UX 10.2 to HP-UX 11i, the C complie upgrate from HP C++ to HP aC++, Oracle from 8i to 9i.

When I compile the program, I got the some warnings like following(the source files are X.cpp and Y.pc):

Warning 749: "X.cpp", line 90 # The cast from '_XDisplay *' to '{unnamed.struct.#99} [in file "X.cpp"] *' is performed as a 'reinterpret_cast'. This operation is non-portable and potentially unsafe.
UxScreen = DefaultScreen(UxDisplay);
^^^^^^^^^^^^^

Warning 829: "Y.cpp", line 1711 # Implicit conversion of string literal to 'char *' is deprecated.
"declare pl_msg VARCHAR2 ( 2000 ) ; pl_id VARCHAR2 ( 100 ) ; CUR

The code in X.cpp regarding to above warning is like this:

Display *UxDisplay;
int UxScreen;

UxDisplay = XtOpenDisplay(...);
UxScreen = DefaultScreen(UxDisplay);

I use PL/SQL in Y.pc, the Y.cpp file is compiled from Y.pc.

Would you please tell me how to fix it or leave them along?

Thanks,
Wendy
4 REPLIES 4
A. Clay Stephenson
Acclaimed Contributor

Re: acc compile warning

Hi Wendy,

ProC is rather notorious for generating fairly loose code but in almost all cases the code is safe just not very strictly type-cast.

If all you see are warnings, you can add this compiler argument to your makefiles
+W747,829 ... to suppress the warning messages for warnings 747 and 829.

Regards, Clay
If it ain't broke, I can fix that.
Wendy_4
Frequent Advisor

Re: acc compile warning

Hi Clay,

Do you think "Display" warning is not a problem too?

Thanks,
Wendy
A. Clay Stephenson
Acclaimed Contributor

Re: acc compile warning

Hi again:

Without digging into your code, I can't tell but clearly what is is telling you is that
UxScreen = DefaultScreen(UxDisplay) is questionable. You may simply need to make an extern declaration something like
extern int DefaultScreen(some_struct *UxDisplay);
or change the declaration of UxScreen to
match the type of DefaultScreen.

These are examples; only your header files know for sure.

If it ain't broke, I can fix that.
Wendy_4
Frequent Advisor

Re: acc compile warning

Hi Clay,

The DefaultScreen is a macro, I find the definition in Xlib.h:
#define DefaultScreen(spy) (((_XPrivDisplay)dpy)->default_screen)

I tried this before:

Display *UxDisplay;
int UxScreen;
_XPrivDisplay xptr;

UxDisplay = XtOpenDisplay(...);
xptr = (_XPrivDisplay)UxDisplay;
UxScreen = xptr->default_screen;

But I got the similar error message.

Thanks,
Wendy