#5 Compiler warning on AIX4.3.2 in window.c

release
closed-fixed
None
3
2001-02-25
2001-01-26
No

Compiling and linking nedit V5.1.1. on AIX machines produces the following warning:

cc -DIBM -DIBM_FWRITE_BUG -DUSE_DIRENT -c window.c
"window.c", line 463.45: 1506-280 (W) Function argument assignment between types "unsigned char*" and "struct _WindowInfo*" is not allowed.

System information (uname -a):

AIX dbssn1fd 3 4 00034341A000

Compiler information (cc -version):

exec: /usr/bin/pg(/usr/bin/pg,//usr/vac/exe/default_msg/vac.help,NULL)
C for AIX Compiler, Version 5
....

Because i only tested nedit, not nc i don't know whether this is bad or not.

Discussion

  • Alexander Mai

    Alexander Mai - 2001-01-26

    A cast has been added to CVS
    which should/might prevent this
    warning.

     
  • Scott Tringali

    Scott Tringali - 2001-01-29
    • priority: 5 --> 3
    • assigned_to: nobody --> amai
    • status: open --> open-fixed
     
  • Scott Tringali

    Scott Tringali - 2001-01-30

    -- tringali --

    The needed cast may indicate a larger problem: namely, that the compiler is
    not seeing the protoype for the XmAddProtocolCallback function. This might
    because the compiler is not compiling in ANSI mode (a misconfiguration) or
    just doesn't support ANSI. My AIX compiler is xlC, and gives very different
    output than shown above.

    -- fnickolai --

    I also tried it with "cc -Aa" on our AIX, which should compile in ANSI mode, and
    got the same warning.

    -- tringali --

    Even in ANSI mode, the compiler might not be setting up the right #defines to
    tell Xt to use ANSI types; seeing char* seems suspicious. Looking at
    Xfuncproto.h:

    #ifndef NeedFunctionPrototypes
    #if defined(FUNCPROTO) || defined(__STDC__) || defined(__cplusplus) ||
    defined(c_plusplus)
    #define NeedFunctionPrototypes 1
    #else
    #define NeedFunctionPrototypes 0
    #endif
    #endif /* NeedFunctionPrototypes */

    ...then in Intrinsic.h:

    #if NeedFunctionPrototypes
    typedef void* XtPointer;
    #else
    typedef char* XtPointer;
    #endif

    Basically, the compiler should #define __STDC__ when in ANSI mode. (On other
    compilers, going in ANSI mode causes this to happen.) What happens if you
    stick a -DFUNCPROTO=1 (or -D__STDC__=1) into the AIX makefile?

    -- fnickolai --

    I tried both:
    -DFUNCPROTO=1 is ok, everything compiles without error.
    But -D__STDC__=1 gives the following message:

    $ cc -DIBM -DIBM_FWRITE_BUG -DUSE_DIRENT -D__STDC__=1 -c window.c
    "window.c": 1506-188 (E) Reserved name __STDC__ cannot be defined as a macro name.
    "window.c", line 463.45: 1506-280 (W) Function argument assignment between types
    "unsigned char*" and "struct _WindowInfo*" is not allowed.

    So I think the best way is not to change the source but the AIX makefile by attaching
    -DFUNCPROTO=1 as compiler option.

    -- tringali --

    Agree. Cast should be removed in favor of proper prototypes.

     
  • Scott Tringali

    Scott Tringali - 2001-01-30

    -- tringali --

    The needed cast may indicate a larger problem: namely, that the compiler is
    not seeing the protoype for the XmAddProtocolCallback function. This might
    because the compiler is not compiling in ANSI mode (a misconfiguration) or
    just doesn't support ANSI. My AIX compiler is xlC, and gives very different
    output than shown above.

    -- fnickolai --

    I also tried it with "cc -Aa" on our AIX, which should compile in ANSI mode, and
    got the same warning.

    -- tringali --

    Even in ANSI mode, the compiler might not be setting up the right #defines to
    tell Xt to use ANSI types; seeing char* seems suspicious. Looking at
    Xfuncproto.h:

    #ifndef NeedFunctionPrototypes
    #if defined(FUNCPROTO) || defined(__STDC__) || defined(__cplusplus) ||
    defined(c_plusplus)
    #define NeedFunctionPrototypes 1
    #else
    #define NeedFunctionPrototypes 0
    #endif
    #endif /* NeedFunctionPrototypes */

    ...then in Intrinsic.h:

    #if NeedFunctionPrototypes
    typedef void* XtPointer;
    #else
    typedef char* XtPointer;
    #endif

    Basically, the compiler should #define __STDC__ when in ANSI mode. (On other
    compilers, going in ANSI mode causes this to happen.) What happens if you
    stick a -DFUNCPROTO=1 (or -D__STDC__=1) into the AIX makefile?

    -- fnickolai --

    I tried both:
    -DFUNCPROTO=1 is ok, everything compiles without error.
    But -D__STDC__=1 gives the following message:

    $ cc -DIBM -DIBM_FWRITE_BUG -DUSE_DIRENT -D__STDC__=1 -c window.c
    "window.c": 1506-188 (E) Reserved name __STDC__ cannot be defined as a macro name.
    "window.c", line 463.45: 1506-280 (W) Function argument assignment between types
    "unsigned char*" and "struct _WindowInfo*" is not allowed.

    So I think the best way is not to change the source but the AIX makefile by attaching
    -DFUNCPROTO=1 as compiler option.

    -- tringali --

    Agree. Cast should be removed in favor of proper prototypes.

     
  • Scott Tringali

    Scott Tringali - 2001-02-25
    • milestone: 100100 --> release
    • assigned_to: amai --> tringali
    • status: open-fixed --> closed-fixed
     
  • Scott Tringali

    Scott Tringali - 2001-02-25

    Logged In: YES
    user_id=11321

    Added -DFUNCPROTO to AIX makefile.

     
  • Scott Tringali

    Scott Tringali - 2001-03-27

    Logged In: YES
    user_id=11321

    Update: we need -DFUNCPROTO=15, as the AIX X headers define
    this to be a (rather odd) bitmask. Otherwise, const and
    other prototypes are dropped.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks