diff options
author | Neil Conway | 2007-01-26 17:45:42 +0000 |
---|---|---|
committer | Neil Conway | 2007-01-26 17:45:42 +0000 |
commit | 93ca8a2e0f6719e126ecc8fddd9e3d93f0ab8f5c (patch) | |
tree | 0825d544d51768dbaf8db62086bfb62638df4924 | |
parent | 44a3d55a99d4e49c28337cec87a36128245afb5e (diff) |
Squelch some VC++ compiler warnings. Mark float literals with the "f"
suffix, to distinguish them from doubles. Make some function declarations
and definitions use the "const" qualifier for arguments consistently.
Ignore warning 4102 ("unreferenced label"), because such warnings
are always emitted by bison-generated code. Patch from Magnus Hagander.
-rw-r--r-- | contrib/intarray/_int.h | 2 | ||||
-rw-r--r-- | contrib/pg_trgm/trgm_op.c | 2 | ||||
-rw-r--r-- | contrib/tsearch2/rank.c | 6 | ||||
-rw-r--r-- | src/include/pg_config.h.win32 | 2 | ||||
-rw-r--r-- | src/interfaces/libpq/fe-secure.c | 3 | ||||
-rw-r--r-- | src/interfaces/libpq/libpq-int.h | 5 | ||||
-rw-r--r-- | src/timezone/ialloc.c | 4 | ||||
-rw-r--r-- | src/timezone/zic.c | 6 | ||||
-rw-r--r-- | src/tools/msvc/Project.pm | 13 | ||||
-rw-r--r-- | src/tools/msvc/mkvcbuild.pl | 1 |
10 files changed, 26 insertions, 18 deletions
diff --git a/contrib/intarray/_int.h b/contrib/intarray/_int.h index bf10f10922..cee970d1b1 100644 --- a/contrib/intarray/_int.h +++ b/contrib/intarray/_int.h @@ -108,7 +108,7 @@ typedef void (*formfloat) (ArrayType *, float *); /* ** useful function */ -bool isort(int4 *a, const int len); +bool isort(int4 *a, int len); ArrayType *new_intArrayType(int num); ArrayType *copy_intArrayType(ArrayType *a); ArrayType *resize_intArrayType(ArrayType *a, int num); diff --git a/contrib/pg_trgm/trgm_op.c b/contrib/pg_trgm/trgm_op.c index 2869033932..f31b9bf572 100644 --- a/contrib/pg_trgm/trgm_op.c +++ b/contrib/pg_trgm/trgm_op.c @@ -5,7 +5,7 @@ PG_MODULE_MAGIC; -float4 trgm_limit = 0.3; +float4 trgm_limit = 0.3f; PG_FUNCTION_INFO_V1(set_limit); Datum set_limit(PG_FUNCTION_ARGS); diff --git a/contrib/tsearch2/rank.c b/contrib/tsearch2/rank.c index f5de5c7746..36fc259400 100644 --- a/contrib/tsearch2/rank.c +++ b/contrib/tsearch2/rank.c @@ -37,7 +37,7 @@ Datum rank_cd_def(PG_FUNCTION_ARGS); PG_FUNCTION_INFO_V1(get_covers); Datum get_covers(PG_FUNCTION_ARGS); -static float weights[] = {0.1, 0.2, 0.4, 1.0}; +static float weights[] = {0.1f, 0.2f, 0.4f, 1.0f}; #define wpos(wep) ( w[ WEP_GETWEIGHT(wep) ] ) @@ -59,7 +59,7 @@ static float4 word_distance(int4 w) { if (w > 100) - return 1e-30; + return (float4)1e-30; return 1.0 / (1.005 + 0.05 * exp(((float4) w) / 1.5 - 2)); } @@ -331,7 +331,7 @@ calc_rank(float *w, tsvector * t, QUERYTYPE * q, int4 method) calc_rank_and(w, t, q) : calc_rank_or(w, t, q); if (res < 0) - res = 1e-20; + res = (float)1e-20; if ((method & RANK_NORM_LOGLENGTH) && t->size > 0) res /= log((double) (cnt_length(t) + 1)) / log(2.0); diff --git a/src/include/pg_config.h.win32 b/src/include/pg_config.h.win32 index bffdae48fe..9f3c1ac869 100644 --- a/src/include/pg_config.h.win32 +++ b/src/include/pg_config.h.win32 @@ -366,7 +366,9 @@ #define HAVE_STRDUP 1 /* Define to 1 if you have the `strerror' function. */ +#ifndef HAVE_STRERROR #define HAVE_STRERROR 1 +#endif /* Define to 1 if you have the `strerror_r' function. */ /* #undef HAVE_STRERROR_R */ diff --git a/src/interfaces/libpq/fe-secure.c b/src/interfaces/libpq/fe-secure.c index b7e919119b..d35bbcccae 100644 --- a/src/interfaces/libpq/fe-secure.c +++ b/src/interfaces/libpq/fe-secure.c @@ -575,7 +575,6 @@ client_cert_cb(SSL *ssl, X509 **x509, EVP_PKEY **pkey) char fnbuf[MAXPGPATH]; FILE *fp; PGconn *conn = (PGconn *) SSL_get_app_data(ssl); - int (*cb) () = NULL; /* how to read user password */ char sebuf[256]; if (!pqGetHomeDirectory(homedir, sizeof(homedir))) @@ -642,7 +641,7 @@ client_cert_cb(SSL *ssl, X509 **x509, EVP_PKEY **pkey) return 0; } #endif - if (PEM_read_PrivateKey(fp, pkey, cb, NULL) == NULL) + if (PEM_read_PrivateKey(fp, pkey, NULL, NULL) == NULL) { char *err = SSLerrmessage(); diff --git a/src/interfaces/libpq/libpq-int.h b/src/interfaces/libpq/libpq-int.h index 7d670c228f..948d8d0dfe 100644 --- a/src/interfaces/libpq/libpq-int.h +++ b/src/interfaces/libpq/libpq-int.h @@ -38,11 +38,6 @@ #include <signal.h> #endif -#ifdef WIN32_ONLY_COMPILER -typedef int ssize_t; /* ssize_t doesn't exist in VC (at least not - * VC6) */ -#endif - /* include stuff common to fe and be */ #include "getaddrinfo.h" #include "libpq/pqcomm.h" diff --git a/src/timezone/ialloc.c b/src/timezone/ialloc.c index feb614b827..c4bc22ad24 100644 --- a/src/timezone/ialloc.c +++ b/src/timezone/ialloc.c @@ -14,7 +14,7 @@ #define nonzero(n) (((n) == 0) ? 1 : (n)) char * -imalloc(const int n) +imalloc(int n) { return malloc((size_t) nonzero(n)); } @@ -28,7 +28,7 @@ icalloc(int nelem, int elsize) } void * -irealloc(void *pointer, const int size) +irealloc(void *pointer, int size) { if (pointer == NULL) return imalloc(size); diff --git a/src/timezone/zic.c b/src/timezone/zic.c index 33e094486b..cc4fdb6725 100644 --- a/src/timezone/zic.c +++ b/src/timezone/zic.c @@ -104,10 +104,10 @@ struct zone }; extern int link(const char *fromname, const char *toname); -static void addtt(pg_time_t starttime, int type); +static void addtt(const pg_time_t starttime, int type); static int addtype(long gmtoff, const char *abbr, int isdst, int ttisstd, int ttisgmt); -static void leapadd(pg_time_t t, int positive, int rolling, int count); +static void leapadd(const pg_time_t t, int positive, int rolling, int count); static void adjleap(void); static void associate(void); static int ciequal(const char *ap, const char *bp); @@ -146,7 +146,7 @@ static void rulesub(struct rule * rp, const char *typep, const char *monthp, const char *dayp, const char *timep); static void setboundaries(void); -static pg_time_t tadd(pg_time_t t1, long t2); +static pg_time_t tadd(const pg_time_t t1, long t2); static void usage(void); static void writezone(const char *name); static int yearistype(int year, const char *type); diff --git a/src/tools/msvc/Project.pm b/src/tools/msvc/Project.pm index 362611114a..437940c274 100644 --- a/src/tools/msvc/Project.pm +++ b/src/tools/msvc/Project.pm @@ -23,7 +23,8 @@ sub new { includes => '', defines => ';', solution => $solution, - disablewarnings => '4018;4244;4273', + disablewarnings => '4018;4244;4273;4102', + disablelinkerwarnings => '' }; bless $self; @@ -242,6 +243,13 @@ sub AddResourceFile { $self->AddFile("$dir\\win32ver.rc"); } +sub DisableLinkerWarnings { + my ($self, $warnings) = @_; + + $self->{disablelinkerwarnings} .= ';' unless ($self->{disablelinkerwarnings} eq ''); + $self->{disablelinkerwarnings} .= $warnings; +} + sub Save { my ($self) = @_; @@ -390,6 +398,9 @@ EOF GenerateMapFile="FALSE" MapFileName=".\\$cfgname\\$self->{name}\\$self->{name}.map" SubSystem="1" TargetMachine="1" EOF + if ($self->{disablelinkerwarnings}) { + print $f "\t\tAdditionalOptions=\"/ignore:$self->{disablelinkerwarnings}\"\n"; + } if ($self->{implib}) { my $l = $self->{implib}; $l =~ s/__CFGNAME__/$cfgname/g; diff --git a/src/tools/msvc/mkvcbuild.pl b/src/tools/msvc/mkvcbuild.pl index 2cb88c14b8..0fcbbffb02 100644 --- a/src/tools/msvc/mkvcbuild.pl +++ b/src/tools/msvc/mkvcbuild.pl @@ -135,6 +135,7 @@ $pgevent->AddFiles('src\bin\pgevent','pgevent.c','pgmsgevent.rc'); $pgevent->AddResourceFile('src\bin\pgevent','Eventlog message formatter'); $pgevent->RemoveFile('src\bin\pgevent\win32ver.rc'); $pgevent->UseDef('src\bin\pgevent\pgevent.def'); +$pgevent->DisableLinkerWarnings('4104'); my $psql = AddSimpleFrontend('psql', 1); $psql->AddIncludeDir('src\bin\pg_dump'); |