[xsd-users] OS-defined type names conflict with schema type names
Dave Simonson
dave at simonsontech.net
Thu Jul 22 16:42:28 EDT 2021
Trying to map a large schema, the code generation seems to go well:
$ xmllint --noout UCSM-IN.xsd
$ cat xsd_opts.txt
cxx-tree
--output-dir /cygdrive/d/UCS_Xfer/schema_4.1.2/src
--std c++11
#--generate-inline
--generate-dep
--show-sloc
--generate-ostream
--generate-doxygen
--generate-polymorphic
--generate-wildcard
--polymorphic-type anyType
--custom-type timezone=timezone_xs
--custom-type clock=clock_xs
--custom-type select=select_xs
#--parts 40
$ xsdcxx --options-file xsd_opts.txt UCSM-IN.xsd
UCSM-IN.xsd:2329:59: warning F001: element 'managedObject' is
implicitly of anyType
UCSM-IN.xsd:2329:59: info: did you forget to specify 'type' attribute?
UCSM-IN.xsd:2393:60: warning F001: element 'externalMethod' is
implicitly of anyType
UCSM-IN.xsd:2393:60: info: did you forget to specify 'type' attribute?
UCSM-IN.xsd:2420:60: warning F001: element 'abstractFilter' is
implicitly of anyType
UCSM-IN.xsd:2420:60: info: did you forget to specify 'type' attribute?
UCSM-IN.xsd: warning T004: generating parsing functions for 733 global
elements
UCSM-IN.xsd: info: use --root-element-* options to specify document
root(s)
/cygdrive/d/UCS_Xfer/schema_4.1.2/src/UCSM-IN.hxx: 187066
/cygdrive/d/UCS_Xfer/schema_4.1.2/src/UCSM-IN.cxx: 507208
total: 694274
$
The compile has problems with types with names that match OS-header
defined types, even though I've tried to rename them (I think) with
-custom_type.
$ gcc -c -I . UCSM-IN.cxx
In file included from UCSM-IN.cxx:41:
UCSM-IN.hxx:1575:9: error: `timezone_xs' does not name a type; did you
mean `timezone'?
1575 | typedef timezone_xs timezone;
| ^~~~~~~~~~~
| timezone
UCSM-IN.hxx:1729:9: error: `select_xs' does not name a type; did you
mean `selector'?
1729 | typedef select_xs select;
| ^~~~~~~~~
| selector
UCSM-IN.hxx:1821:9: error: `clock_xs' does not name a type; did you
mean `clock_t'?
1821 | typedef clock_xs clock;
| ^~~~~~~~
| clock_t
In file included from UCSM-IN.cxx:41:
UCSM-IN.hxx:113000:13: error: `timezone' in namespace `::' does not
name a type
113000 | typedef ::timezone timezone_type;
| ^~~~~~~~
In file included from /usr/include/time.h:153,
from /usr/include/pthread.h:14,
from
/usr/lib/gcc/x86_64-pc-cygwin/10/include/c++/x86_64-pc-cygwin/bits/gth
r-default.h:35,
from
/usr/lib/gcc/x86_64-pc-cygwin/10/include/c++/x86_64-pc-cygwin/bits/gth
r.h:148,
from
/usr/lib/gcc/x86_64-pc-cygwin/10/include/c++/ext/atomicity.h:35,
from
/usr/lib/gcc/x86_64-pc-cygwin/10/include/c++/bits/basic_string.h:39,
from
/usr/lib/gcc/x86_64-pc-cygwin/10/include/c++/string:55,
from /usr/include/xsd/cxx/xml/char-utf8.hxx:9,
from UCSM-IN.hxx:67,
from UCSM-IN.cxx:41:
/usr/include/cygwin/time.h:33:13: note: `timezone' declared here
33 | extern long timezone __asm__ (_SYMSTR (_timezone));
| ^~~~~~~~
In file included from UCSM-IN.cxx:41:
UCSM-IN.hxx:113005:39: error: `timezone_type' was not declared in this
scope; did you mean `timezone'?
113005 | typedef ::xsd::cxx::tree::optional< timezone_type >
timezone_optional;
| ^~~~~~~~~~~~~
| timezone
...
I'm using:
gcc version 10.2.0 (GCC)
CodeSynthesis XSD XML Schema to C++ compiler 4.0.0
What have I missed? This can't be that uncommon, but I haven't found
anything in the archives or documentation. Any suggestions?
More information about the xsd-users
mailing list