Ethereal-dev: Re: [Ethereal-dev] Portability patches

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

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Mon, 10 Nov 2003 12:18:53 -0800

On Nov 9, 2003, at 4:20 PM, Albert Chin wrote:

On Sun, Nov 09, 2003 at 02:19:40PM -0800, Guy Harris wrote:
On Sun, Nov 09, 2003 at 04:07:35AM -0600, Albert Chin wrote:
1. HP C compiler complains about typedef before enum declared
   (HP-UX 10.20).

Checked in.  (Is that legal ANSI C, or is that just an HP C compiler
deficiency?  My ANSI C standard is at work....)

Dunno. My copy is at work too :)

I suspect it might not be legal ANSI C, so the HP compiler might be allowed to reject it. I don't think ANSI C allows

	typedef struct foo foo_t;

without at least an incomplete definition of "struct foo", and the same would presumably apply to enums.

3. P_SID in <sys/procset.h> on HP-UX 10.20 and Tru64 UNIX.

I checked in a change a few days ago to get rid of includes of
<gmodule.h>, <sys/types.h>, and <netinet/in.h>; I don't think they're
needed, and they might keep <sys/procset.h> from being included.

See whether getting rid of those #includes, and reverting back to P_SID,
works.

I copied the latest packet-ansi_a.c from CVS and still get the error.

I'm curious what causes all that stuff to be included, in case there's some #include we can get rid of. Any idea?

4. HP C compiler on HP-UX 10.20 complains about the initializer for
   ett ("Array size must be a constant expression.").

At least as I read that code, it *is* a constant expression; am I
missing something, or is this a deficiency of that C compiler?

Looks like a deficiency of the compiler. This works:
  static gint *ett[sizeof(ansi_dtap_strings)/sizeof(value_string)]
But this does not:
static gint *ett[sizeof(ansi_dtap_strings)/sizeof(value_string) < 0 ? 0 : 1]

Sigh. I've checked in your patch to work around that deficiency; unless I'm missing something, the ANSI C89 spec says the array size in the latter example *is* a constant expression. If the latest version of the HP C compiler thinks it's not, you might want to report that as a bug.