diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2006-10-01 20:56:15 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2006-10-01 20:56:15 +0000 |
commit | 9184208ec40610f6856907fa00d814ae093d3e3b (patch) | |
tree | 8566240342f5d4e935e1953f4932906dcadd13e7 | |
parent | 1ef976008e8a31d952047e7585b28e324c2e1f7b (diff) | |
download | netpbm-mirror-9184208ec40610f6856907fa00d814ae093d3e3b.tar.gz netpbm-mirror-9184208ec40610f6856907fa00d814ae093d3e3b.tar.xz netpbm-mirror-9184208ec40610f6856907fa00d814ae093d3e3b.zip |
Fix multiple function definitions for Irix compiler
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@81 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r-- | generator/pamstereogram.c | 9 | ||||
-rw-r--r-- | lib/libppmd.c | 8 | ||||
-rw-r--r-- | other/pnmcolormap.c | 7 | ||||
-rw-r--r-- | pm_config.in.h | 22 |
4 files changed, 40 insertions, 6 deletions
diff --git a/generator/pamstereogram.c b/generator/pamstereogram.c index e9e58677..71c541df 100644 --- a/generator/pamstereogram.c +++ b/generator/pamstereogram.c @@ -49,6 +49,7 @@ #include <time.h> #include <assert.h> +#include "pm_config.h" #include "pam.h" #include "shhopt.h" #include "mallocvar.h" @@ -299,7 +300,9 @@ struct randomState { }; +#ifndef LITERAL_FN_DEF_MATCH static coord2Color randomColor; +#endif static tuple randomColor(outGenerator * const outGenP, @@ -336,7 +339,9 @@ randomColor(outGenerator * const outGenP, +#ifndef LITERAL_FN_DEF_MATCH static outGenStateTerm termRandomColor; +#endif static void termRandomColor(outGenerator * const outGenP) { @@ -402,7 +407,9 @@ struct patternPixelState { +#ifndef LITERAL_FN_DEF_MATCH static coord2Color patternPixel; +#endif static tuple patternPixel(outGenerator * const outGenP, @@ -431,7 +438,9 @@ patternPixel(outGenerator * const outGenP, +#ifndef LITERAL_FN_DEF_MATCH static outGenStateTerm termPatternPixel; +#endif static void termPatternPixel(outGenerator * const outGenP) { diff --git a/lib/libppmd.c b/lib/libppmd.c index 6c764ca1..ac8b6dee 100644 --- a/lib/libppmd.c +++ b/lib/libppmd.c @@ -18,15 +18,13 @@ #include <assert.h> #include <stdlib.h> +#include "pm_config.h" #include "pm_c_util.h" #include "mallocvar.h" #include "ppm.h" #include "ppmdfont.h" #include "ppmdraw.h" -typedef int qsort_compare(const void *, const void *); - /* A compare function to pass to stdlib.h's qsort() */ - #define DDA_SCALE 8192 @@ -779,7 +777,9 @@ ppmd_fill_drawproc(pixel** const pixels, -static qsort_compare yx_compare; +#ifndef LITERAL_FN_DEF_MATCH +static qsort_comparison_fn yx_compare; +#endif static int yx_compare(const void * const c1Arg, diff --git a/other/pnmcolormap.c b/other/pnmcolormap.c index c4776001..1be54ef8 100644 --- a/other/pnmcolormap.c +++ b/other/pnmcolormap.c @@ -25,6 +25,7 @@ #include <math.h> +#include "pm_config.h" #include "pam.h" #include "pammap.h" #include "shhopt.h" @@ -166,10 +167,10 @@ parseCommandLine (int argc, char ** argv, } -typedef int qsort_comparison_fn(const void *, const void *); - /* A collation function to be used as argument to qsort() */ +#ifndef LITERAL_FN_DEF_MATCH static qsort_comparison_fn compareplane; +#endif static unsigned int compareplanePlane; /* This is a parameter to compareplane(). We use this global variable @@ -189,7 +190,9 @@ compareplane(const void * const arg1, +#ifndef LITERAL_FN_DEF_MATCH static qsort_comparison_fn sumcompare; +#endif static int sumcompare(const void * const b1, const void * const b2) { diff --git a/pm_config.in.h b/pm_config.in.h index 9fc55351..1956f5d3 100644 --- a/pm_config.in.h +++ b/pm_config.in.h @@ -222,6 +222,26 @@ extern int write(); #endif #endif +/* At least one compiler can't handle two declarations of the same function + that aren't literally identical. E.g. "static foo_fn_t foo1;" conflicts + with "static void foo1(int);" even if type 'foo_fn_t' is defined as + void(int). (The compiler we saw do this is SGI IDO cc (for IRIX 4.3)). + + LITERAL_FN_DEF_MATCH says that the compiler might have this problem, + so one must be conservative in redeclaring functions. +*/ +#if defined(__GNUC__) + #define LITERAL_FN_DEF_MATCH 0 +#else + #if (defined(__sgi)) + #define LITERAL_FN_DEF_MATCH 1 + #else + #define LITERAL_FN_DEF_MATCH 0 + #endif +#endif + + + /* CONFIGURE: Some systems seem to need more than standard program linkage to get a data (as opposed to function) item out of a library. @@ -276,3 +296,5 @@ typedef long int pm_filepos; #define HAVE_MKSTEMP 1 #endif +typedef int qsort_comparison_fn(const void *, const void *); + /* A compare function to pass to <stdlib.h>'s qsort() */ |