[tlbuild] On the warnings emitted by gcc4 on Cygwin

Angelo Graziosi angelo.graziosi at alice.it
Mon Sep 15 19:26:16 CEST 2008


As I have flagged here [1] that using gcc4 on Cygwin gives many
warnings. I want to recall your attention on this type of warnings:

-------------------------------------------------------------------
gcc-4 -DHAVE_CONFIG_H  -I. -I../../../../texk/web2c/web2c -I../.. 
-I../../../../texk/web2c/.. -I.. -I../../../../texk/web2c/web2c/..  -g 
-O2  -c ../../../../texk/web2c/web2c/splitup.c
In file included from ../../../../texk/web2c/web2c/splitup.c:10:
../../../../texk/web2c/../kpathsea/getopt.h:53: warning: 'optarg' 
redeclared without dllimport attribute: previous dllimport ignored
../../../../texk/web2c/../kpathsea/getopt.h:67: warning: 'optind' 
redeclared without dllimport attribute: previous dllimport ignored
../../../../texk/web2c/../kpathsea/getopt.h:72: warning: 'opterr' 
redeclared without dllimport attribute: previous dllimport ignored
../../../../texk/web2c/../kpathsea/getopt.h:76: warning: 'optopt' 
redeclared without dllimport attribute: previous dllimport ignored
-------------------------------------------------------------------

Now on Cygwin, /usr/include/getopt.h has:

-------------------------------------------------------------------
#ifndef __INSIDE_CYGWIN__
extern int __declspec(dllimport) opterr;        /* if error message 
should be printed */
extern int __declspec(dllimport) optind;        /* index into parent 
argv vector */
extern int __declspec(dllimport) optopt;        /* character checked for 
validity */
extern int __declspec(dllimport) optreset;      /* reset getopt */
extern char __declspec(dllimport) *optarg;      /* argument associated 
with option */
#endif
-------------------------------------------------------------------

which are included and then annulled by kpathsea/getopt.h:

-------------------------------------------------------------------
#if defined (KPSE_DLL) && (defined (WIN32) || defined (__CYGWIN__))
#ifdef MAKE_KPSE_DLL
#define KPSEDLL __declspec(dllexport)
#else /* ! MAKE_KPSE_DLL */
#define KPSEDLL __declspec(dllimport)
#endif
#else /* ! (KPSE_DLL && (WIN32 || __CYGWIN__)) */
#define KPSEDLL
#endif

extern KPSEDLL char *optarg;
...
-------------------------------------------------------------------

Indeed, only __CYGWIN__ is defined, so that KPSEDLL is empty.

I see the above code also in kpathsea/c-proto.h, while
texk/web2c/config.h contains

-------------------------------------------------------------------
#if defined (TEX_DLL) && (defined (WIN32) || defined (__CYGWIN__))
#ifdef MAKE_TEX_DLL
#define TEXDLL __declspec (dllexport)
#else /* ! MAKE_TEX_DLL */
#define TEXDLL __declspec (dllimport)
#endif
#else /* ! (TEX_DLL && (WIN32 || __CYGWIN__)) */
#define TEXDLL
#endif
-------------------------------------------------------------------

which is similar.

Are we sure that the above is the right code for Cygwin?


Thanks,
    Angelo.

(For the sake of completeness, gcc-3.4.4 simply omits the above
warnings!)

---
[1] http://tug.org/pipermail/tlbuild/2008q3/000396.html


More information about the tlbuild mailing list