Ethereal-dev: [Ethereal-dev] ethereal0.9.5: capture.c makes HP ANSI Compiler barf

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Jost Martin <martin.jost@xxxxxxxxxxx>
Date: Tue, 20 Aug 2002 13:57:54 +0200
Hello,

right now, capture.c from ethereal0.9.5 awfully upsets HPs ANSI-C-Compiler on HPUX 10.20
(
delphi:/pd-sw/sysadm/ethereal/ethereal-0.9.5> what `which cc`
/opt/ansic/bin/cc:
              LINT A.10.32.30 CXREF  A.10.32.30
        HP92453-01 A.10.32.30 HP C Compiler
         /usr/lib/libc: $Revision: 76.3 $
)

This is what happens:

cc -DHAVE_CONFIG_H -I. -I. -I.   -I/pd/libs/include/ -I. -I./wiretap -I/usr/local/include  -Ae +O2 -D_U_="" +DAportable -Ae +O2 -I. -I./wiretap -I/usr/local/include -I/pd/libs/include/gtk-1.2 -I/pd/libs/include/glib-1.2 -I/pd/libs/lib/glib/include -c capture.c
cc: "/pd/libs/include/glib.h", line 2077: warning 617: Redeclaration of tag "tm" ignored.
cc: "capture.c", line 179: warning 562: Redeclaration of "sync_pipe" with a different storage class specifier: "sync_pipe" will have internal linkage.
cc: "capture.c", line 1332: error 1000: Unexpected symbol: "}".
cc: "capture.c", line 1344: error 1000: Unexpected symbol: "static".
cc: "capture.c", line 1348: error 1000: Unexpected symbol: "int".
cc: "capture.c", line 1350: error 1000: Unexpected symbol: "{".
cc: "capture.c", line 1366: warning 518: Redeclaration of "errmsg" hides formal parameter.
cc: "capture.c", line 1375: error 1529: Cannot select field of non-structure.
cc: "capture.c", line 1375: error 1529: Cannot select field of non-structure.
cc: "capture.c", line 1375: error 1555: Address operator requires an lvalue.
cc: "capture.c", line 1375: error 1521: Incorrect initialization.
cc: "capture.c", line 1376: error 1529: Cannot select field of non-structure.
cc: "capture.c", line 1376: error 1529: Cannot select field of non-structure.
cc: "capture.c", line 1376: error 1555: Address operator requires an lvalue.
cc: "capture.c", line 1376: error 1521: Incorrect initialization.
cc: "capture.c", line 1377: error 1529: Cannot select field of non-structure.
cc: "capture.c", line 1377: error 1529: Cannot select field of non-structure.
cc: "capture.c", line 1377: error 1555: Address operator requires an lvalue.
cc: "capture.c", line 1377: error 1521: Incorrect initialization.
cc: "capture.c", line 1378: error 1529: Cannot select field of non-structure.
cc: "capture.c", line 1378: error 1529: Cannot select field of non-structure.
cc: "capture.c", line 1378: error 1555: Address operator requires an lvalue.
cc: "capture.c", line 1378: error 1521: Incorrect initialization.
[...]

The reason seems to be an empty 'case' befor the '}'.
With the following change ("break;" added), it compiles smoothely:

*** capture.c.~1~       Sun Jun 23 16:40:52 2002
--- capture.c   Tue Aug 20 13:00:22 2002
***************
*** 1326,1334 ****
    case PD_PIPE_ERR:
      snprintf(errmsg, errmsgl, "Error reading from pipe: %s",
        strerror(errno));
    case PD_ERR:
      /* Fall out */
! 
    }
  
    ld->pipe_err = PIPERR;
--- 1326,1335 ----
    case PD_PIPE_ERR:
      snprintf(errmsg, errmsgl, "Error reading from pipe: %s",
        strerror(errno));
+ 
    case PD_ERR:
      /* Fall out */
!     break;
    }
  
    ld->pipe_err = PIPERR;

It would be nice, if a solution for this problem would be integrated in the distribution.

Thanks !

Martin Jost

P.S.:
Please contact me, if you need further details !