[tex-k] Apparent include loop in str-llist.h
Norman Gray
norman at astro.gla.ac.uk
Sun Apr 14 13:23:50 CEST 2013
Greetings.
When trying to build a standalone version of the kpathsea library, I've come across what appears to be an include loop in the headers.
kpathsea/types.h includes kpathsea/str-llist.h, which includes kpathsea/types.h. This leads at least one version of gcc into terminal confusion:
% gcc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
% cat try.c
#include <kpathsea/pathsearch.h>
% gcc -I $T/kpathsea-6.1.1/include try.c
In file included from /Data/tools/kpathsea-6.1.1/include/kpathsea/str-llist.h:26,
from /Data/tools/kpathsea-6.1.1/include/kpathsea/pathsearch.h:23,
from try.c:1:
/Data/tools/kpathsea-6.1.1/include/kpathsea/types.h:88: error: expected specifier-qualifier-list before ‘str_llist_type’
%
(Here, .../kpathsea-6.1.1 contains an install of the current SVN HEAD).
Note: i686-apple-darwin11-llvm-gcc-4.2 is the default compiler on OS X 10.8.
This is fixed (not necessarily ideally) by:
% svn diff str-llist.h
Index: str-llist.h
===================================================================
--- str-llist.h (revision 29913)
+++ str-llist.h (working copy)
@@ -23,7 +23,9 @@
#define STR_LLIST_H
#include <kpathsea/c-proto.h>
-#include <kpathsea/types.h>
+/* Do not include types.h, because that wants to include this file */
+/* types.h defines string to be char* and boolean to be int */
+/* #include <kpathsea/types.h> */
/* It's a little bizarre to be using the same type for the list and the
@@ -33,8 +35,10 @@
struct str_llist_elt
{
- string str;
- boolean moved;
+ char * str;
+ int moved;
+ /* string str; */ /* ...with types.h */
+ /* boolean moved; */
struct str_llist_elt *next;
};
typedef struct str_llist_elt str_llist_elt_type;
%
Best wishes,
Norman
--
Norman Gray : http://nxg.me.uk
SUPA School of Physics and Astronomy, University of Glasgow, UK
More information about the tex-k
mailing list