GNOME Bugzilla – Bug 570806
trio.c fails to compile
Last modified: 2009-03-03 06:38:18 UTC
Please describe the problem: trio.c (from libxml2 2.7.3) fails to compile with the following error: Error: undefined identifier 'errno' trio.c line 1210 save_errno = errno; Steps to reproduce: 1. 2. 3. Actual results: Expected results: Does this happen every time? Yes Other information: The problem is due to `#include <errno.h>` being guarded with `#ifdef HAVE_ERRNO_H`. HAVE_ERRNO_H is NEVER defined as config.h is NOT included. Adding `#include "config.h"` as the first include appears to fix the problem.
I do not understand what you are doing. 1) trio.c includes trio.h 2) trio.h includes config.h provided that a) TRIO_TRIO_H is not defined b) WITHOUT_TRIO is not defined c) HAVE_CONFIG_H is defined 3) HAVE_CONFIG_H is (normally) defined within Makefile Which of these steps is going wrong for you, and why?
I'm not using a makefile. I'm using an Xcode project. OK, so perhaps I should add -D HAVE_CONFIG_H to the Xcode project, but this worked before without it. The problem appeared because a test for HAVE_ERRNO_H was added to trio.c, so it should also include "config.h". The file trio.h tries to include <config.h> when, clearly, it should be "config.h".
Actually, that should be "-DHAVE_CONFIG_H" (no space). The test for HAVE_ERRNO_H was added on April 17, 2007 in order to ease compilation on Windows CE, and was a part of libxml2-2.6.28. I would concur that enclosing config.h in quotation marks would be better, and have made that change in SVN. I also note that trio.h has been like that for around 5 years. Thank you for the report.