Compilation issues when compiling under HP-UX B.11.31.

Mike Jetzer <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <CANm2B1nTz-K4Qft8jRt-h8D5g7WTzmrufqV3a-4Wg3CokCM-rQ@mail.gmail.com>
Two compilation issues with freetds-0.95.89 (as well as .88 and .80) when
compiling under HP-UX B.11.31 with the "HP C/aC++ B3910B A.06.20 [May 13
2008]" compiler in 32-bit mode.  Both have simple work-arounds which are
fine for my requirements, but I thought I'd report them to be addressed
when time permits.

src/tds/token.c generates a 'warning #2513-D: a value of type "int" cannot
be assigned to an entity of type "char *" because <alloca.h> has not been
#included:
        nbcbuf = alloca((info->num_cols + 7) / 8);
               ^

Simply adding an "#include <alloca.h>" to token.c solves the issue.  I did
not include a patch file because I imagine that this would most properly be
resolved via configure/config.h rather than unconditionally adding it to
token.c.  (In the version of Linux I use, <stdlib.h> performs an #include
of <alloca.h> with the default compiler defines, so a prototype is present
and gcc produces no similar warning.)


The second issue is with src/dblib/dbpivot.c, which generates a large
number of 'error #2136: struct "col_t" has no field "XX" errors due to the
anonymous union in struct col_t's definition.  A Google search implies that
anonymous unions were once a gcc extension but were adopted in C11; the
HP-UX compiler only accepts up to and including C99.

My work-around was to assign a name to the union and then update references
to the union members with this union name.  I am not including a patch
because I just named the union "x" and do not know what a more logical name
for the union might be.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.