This discussion is archived
3 Replies Latest reply: Dec 3, 2012 9:06 AM by Steve_Clamage RSS

PROC: warnings from CC compiler when compiling a .pc to .c file

977242 Newbie
Currently Being Moderated
Dears,

I'm getting unexpected warnings from CC compiler while compiling a C file generated from a PROC file.

Below is the list of warnings (there are only 2 warnings appearing multiple times) that I'm encountering:

line 43: Warning: Partially bracketed initialization for sqladt.
line 57: Warning: Partially bracketed initialization for sqltds.
line 114: Warning: Partially bracketed initialization for sqlstm.
line 601: Warning: sqlstm hides the same name in an outer scope.
line 674: Warning: sqlstm hides the same name in an outer scope.
line 755: Warning: sqlstm hides the same name in an outer scope.
line 818: Warning: sqlstm hides the same name in an outer scope.
line 849: Warning: sqlstm hides the same name in an outer scope.
line 957: Warning: sqlstm hides the same name in an outer scope.
line 1004: Warning: sqlstm hides the same name in an outer scope.
line 1076: Warning: sqlstm hides the same name in an outer scope.
line 1124: Warning: sqlstm hides the same name in an outer scope.
line 1199: Warning: sqlstm hides the same name in an outer scope.

Please find below the details of the precompiler & compiler that I'm using:
PROC version:
Pro*C/C++: Release 10.2.0.4.0

CC version:
CC: Sun C++ 5.8 Patch 121017-01 2005/12/11

I'm using the following Oracle flags in the Makefile:
SQLCHECK=FULL \
USERID=$(ORACLE_PROCUSR) \
CODE=CPP \
MODE=ORACLE

Please let me know why I'm getting these warnings & will they pose any problem while executing the binary under any special circumstances (like core dump).

Also please let me know if you need anymore information.

Any help is greatly appreciated.

Thanks in advance.

Regards,
Supreeth
  • 1. Re: PROC: warnings from CC compiler when compiling a .pc to .c file
    Steve_Clamage Pro
    Currently Being Moderated
    C++ 5.8, part of Studio 11, is End Of Life, and little support is available for it. You should consider updating to a newer release. The current release, Studio 12.3, supports Solaris 10 and 11. If you are using an older version of Solaris, earlier Studio release are still available:
    http://www.oracle.com/technetwork/server-storage/solarisstudio/overview/index.html

    The warnings are likely to be harmless, but you would have to inspect the C++ code to be sure.

    Partially-bracketed initialization means code similar to this:
    struct A {int i, j; };
    struct B { A a1, a2; };
    B b = { {1, 2}, 3, 4 }; // the a2 initializer is not bracketed 
    The code is only a problem when the number of initializers does not match the number of struct members being initialized, and the initializers don't match up with what you want to initialize. Only the programmer knows whether the code is OK.
    This warning appears only when you compile using the +w2 option, which asks for extra-picky warnings that normally would be suppressed. You can evaluate whether you want to use this option.

    The "hiding name" warning appears when a local name has the same spelling as a name in an outer scope. Duplicating names is generally a poor programming practice, since it can introduce errors that are hard to find. That is, you might think you are referring to a global x when a local x hides it. Or you might remove a local x and code referencing it does not generate an error because it now incorrectly refers to a global x.

    If you have questions specifically about using PRO*C, you are more likely to find an answer in an Oracle database programming forum. Start here:
    https://forums.oracle.com/forums/category.jspa?categoryID=18
  • 2. Re: PROC: warnings from CC compiler when compiling a .pc to .c file
    977242 Newbie
    Currently Being Moderated
    Hi Steve,

    Thanks for your reply.

    Yes, I'm using +w2 flag & hence these warnings are appearing.

    When this flag is not used, I don't get the warnings.

    "Hiding Name" warning is appearing because of the structure instance "sqlstm". This structure replaces the PROC statements when compiled by proc compiler. It is not manually defined or declared.
    There is also no repetitve variables in the proc file. I mean there is no clash between local & global variables.

    Sorry, I can't upgrade the compiler as it is a client server.

    I thought of proceeding to compile the code without +w2 which produces technical warnings that are probably harmless.

    I think there is no such warnings if the code is compiled using gcc compiler.

    Regards,
    Supreeth
  • 3. Re: PROC: warnings from CC compiler when compiling a .pc to .c file
    Steve_Clamage Pro
    Currently Being Moderated
    As discussed in the C++ Users Guide
    http://docs.oracle.com/cd/E24457_01/html/E21991/bkana.html#bkayc
    The +w option "Identifies code that might have unintended consequences."
    The +w2 option adds "warnings about technical violations that are probably harmless but that might reduce the maximum portability of your program."

    Based on feedback from customers, we occasionally move warnings among the three categories "default", "+w" and "+w2".

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points