[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dvipng] dvipng and mmap preprocessor woes
From: |
Karl Berry |
Subject: |
[Dvipng] dvipng and mmap preprocessor woes |
Date: |
Mon, 28 Apr 2008 19:49:42 -0500 |
Hi Jan,
Vladimir discovered that dvipng/misc.c did not compile on AIX, where
mmap is a macro. This interferes with its usage as a structure member
name in dvipng's struct filemmap. (And this is allowed by C/POSIX
standards as far as I know -- my understanding is that basically any
"function" name can be a macro, as long as the result is addressable.)
Vladimir found a workaround (see patch and all the details below), but I
think the cleanest solution would be to simply rename the member field.
If you'd accept that, perhaps Vladimir or I could send you a patch for
that. (Vladimir: meanwhile, I installed your change below.)
By the way, do you have any plans to make another dvipng release? I'm
sorry for not writing earlier; I'd like to get the TeX Live tree to the
other builders as soon as possible.
Thanks,
Karl
Date: Sun, 27 Apr 2008 21:11:56 -0700
From: Vladimir Volovich <address@hidden>
To: address@hidden (Karl Berry)
[...] what is happening is that texk/dvipng/misc.c #includes "dvipng.h"
which defines struct filemmap containing the field called "mmap".
then, misc.c includes <sys/mman.h>, which has "#define mmap mmap64",
so subsequent occurences of "mmap" get correctly translated to "mmap64".
but since "dvipng.h" was included prior to <sys/mman.h>, the "mmap"
field in "struct filemmap" was not affected by the "#define mmap
mmap64", which leads to inconsistency with later code which accesses the
"mmap" field (but because of "#define mmap mmap64" actually accesses
"mmap64" field).
so probably a better fix is to load "dvipng.h" after system headers,
ensuring that the same macros will apply to all code:
================================
--- texk/dvipng/misc.c
+++ texk/dvipng/misc.c
@@ -23,7 +23,6 @@
************************************************************************/
-#include "dvipng.h"
#ifdef HAVE_LIBGEN_H
# include <libgen.h>
#else
@@ -34,6 +33,7 @@
#include <sys/mman.h>
#endif
#include <sys/stat.h>
+#include "dvipng.h"
static char *programname;
================================
- [Dvipng] dvipng and mmap preprocessor woes,
Karl Berry <=