Make pgsql compile on FreeBSD-alpha.

Context diff this time.

Remove -m486 compile args for FreeBSD-i386, compile -O2 on i386.

Compile with only -O on alpha for codegen safety.

Make the port use the TEST_AND_SET for alpha and i386 on FreeBSD.

Fix a lot of bogus string formats for outputting pointers (cast to int
and %u/%x replaced with no cast and %p), and 'Size'(size_t) are now
cast to 'unsigned long' and output with %lu/

Remove an unused variable.

Alfred Perlstein
This commit is contained in:
Bruce Momjian 2000-11-16 05:51:07 +00:00
parent 580d2bc60f
commit 312063c97b
14 changed files with 69 additions and 58 deletions

View File

@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.45 2000/09/23 22:40:12 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.46 2000/11/16 05:50:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -139,7 +139,8 @@ index_formtuple(TupleDesc tupleDescriptor,
*/
if ((size & INDEX_SIZE_MASK) != size)
elog(ERROR, "index_formtuple: data takes %d bytes: too big", size);
elog(ERROR, "index_formtuple: data takes %lu bytes: too big",
(unsigned long)size);
infomask |= size;

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Id: hio.c,v 1.33 2000/09/07 09:58:35 vadim Exp $
* $Id: hio.c,v 1.34 2000/11/16 05:50:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -91,8 +91,8 @@ RelationGetBufferForTuple(Relation relation, Size len)
* If we're gonna fail for oversize tuple, do it right away
*/
if (len > MaxTupleSize)
elog(ERROR, "Tuple is too big: size %u, max size %ld",
len, MaxTupleSize);
elog(ERROR, "Tuple is too big: size %lu, max size %ld",
(unsigned long)len, MaxTupleSize);
if (!relation->rd_myxactonly)
LockPage(relation, 0, ExclusiveLock);
@ -139,7 +139,8 @@ RelationGetBufferForTuple(Relation relation, Size len)
if (len > PageGetFreeSpace(pageHeader))
{
/* We should not get here given the test at the top */
elog(STOP, "Tuple is too big: size %u", len);
elog(STOP, "Tuple is too big: size %lu",
(unsigned long)len);
}
}

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.67 2000/10/21 15:43:18 vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.68 2000/11/16 05:50:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -348,8 +348,8 @@ _bt_insertonpg(Relation rel,
* itemsz doesn't include the ItemId.
*/
if (itemsz > (PageGetPageSize(page) - sizeof(PageHeaderData) - MAXALIGN(sizeof(BTPageOpaqueData))) / 3 - sizeof(ItemIdData))
elog(ERROR, "btree: index item size %u exceeds maximum %lu",
itemsz,
elog(ERROR, "btree: index item size %lu exceeds maximum %lu",
(unsigned long)itemsz,
(PageGetPageSize(page) - sizeof(PageHeaderData) - MAXALIGN(sizeof(BTPageOpaqueData))) /3 - sizeof(ItemIdData));
/*

View File

@ -35,7 +35,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsort.c,v 1.57 2000/08/10 02:33:20 inoue Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsort.c,v 1.58 2000/11/16 05:50:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -346,8 +346,8 @@ _bt_buildadd(Relation index, BTPageState *state, BTItem bti)
* during creation of an index, we don't go through there.
*/
if (btisz > (PageGetPageSize(npage) - sizeof(PageHeaderData) - MAXALIGN(sizeof(BTPageOpaqueData))) / 3 - sizeof(ItemIdData))
elog(ERROR, "btree: index item size %d exceeds maximum %ld",
btisz,
elog(ERROR, "btree: index item size %lu exceeds maximum %ld",
(unsigned long)btisz,
(PageGetPageSize(npage) - sizeof(PageHeaderData) - MAXALIGN(sizeof(BTPageOpaqueData))) /3 - sizeof(ItemIdData));
if (pgspc < btisz || pgspc < state->btps_full)

View File

@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.25 2000/11/09 11:25:58 vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.26 2000/11/16 05:50:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -1274,7 +1274,6 @@ BootStrapXLOG()
int fd;
char buffer[BLCKSZ];
CheckPoint checkPoint;
bool usexistent = false;
#ifdef XLOG
XLogPageHeader page = (XLogPageHeader) buffer;

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.171 2000/10/28 16:20:54 vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.172 2000/11/16 05:50:59 momjian Exp $
*
*-------------------------------------------------------------------------
@ -950,12 +950,13 @@ scan_heap(VRelStats *vacrelstats, Relation onerel,
}
elog(MESSAGE_LEVEL, "Pages %u: Changed %u, reaped %u, Empty %u, New %u; \
Tup %u: Vac %u, Keep/VTL %u/%u, Crash %u, UnUsed %u, MinLen %u, MaxLen %u; \
Re-using: Free/Avail. Space %u/%u; EndEmpty/Avail. Pages %u/%u. %s",
Tup %u: Vac %u, Keep/VTL %u/%u, Crash %u, UnUsed %u, MinLen %lu, MaxLen %lu; \
Re-using: Free/Avail. Space %lu/%lu; EndEmpty/Avail. Pages %u/%u. %s",
nblocks, changed_pages, vacuum_pages->num_pages, empty_pages,
new_pages, num_tuples, tups_vacuumed,
nkeep, vacrelstats->num_vtlinks, ncrash,
nunused, min_tlen, max_tlen, free_size, usable_free_size,
nunused, (unsigned long)min_tlen, (unsigned long)max_tlen,
(unsigned long)free_size, (unsigned long)usable_free_size,
empty_end_pages, fraged_pages->num_pages,
show_rusage(&ru0));
@ -1484,8 +1485,8 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
InvalidOffsetNumber, LP_USED);
if (newoff == InvalidOffsetNumber)
{
elog(STOP, "moving chain: failed to add item with len = %u to page %u",
tuple_len, destvacpage->blkno);
elog(STOP, "moving chain: failed to add item with len = %lu to page %u",
(unsigned long)tuple_len, destvacpage->blkno);
}
newitemid = PageGetItemId(ToPage, newoff);
pfree(newtup.t_data);
@ -1636,8 +1637,8 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
if (newoff == InvalidOffsetNumber)
{
elog(ERROR, "\
failed to add item with len = %u to page %u (free space %u, nusd %u, noff %u)",
tuple_len, cur_page->blkno, cur_page->free,
failed to add item with len = %lu to page %u (free space %lu, nusd %u, noff %u)",
(unsigned long)tuple_len, cur_page->blkno, (unsigned long)cur_page->free,
cur_page->offsets_used, cur_page->offsets_free);
}
newitemid = PageGetItemId(ToPage, newoff);

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/main/main.c,v 1.33 2000/10/21 22:36:11 petere Exp $
* $Header: /cvsroot/pgsql/src/backend/main/main.c,v 1.34 2000/11/16 05:51:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -17,7 +17,7 @@
#include <pwd.h>
#include <unistd.h>
#if defined(__alpha) && !defined(linux)
#if defined(__alpha) && !defined(linux) && !defined(__FreeBSD__)
#include <sys/sysinfo.h>
#include "machine/hal_sysinfo.h"
#define ASSEMBLER

View File

@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.132 2000/11/12 00:36:57 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.133 2000/11/16 05:51:00 momjian Exp $
*
* NOTES
* Every (plan) node in POSTGRES has an associated "out" routine which
@ -688,8 +688,8 @@ _outFjoin(StringInfo str, Fjoin *node)
appendStringInfo(str, " :innerNode ");
_outNode(str, node->fj_innerNode);
appendStringInfo(str, " :results @ 0x%x :alwaysdone",
(int) node->fj_results);
appendStringInfo(str, " :results @ 0x%p :alwaysdone",
node->fj_results);
for (i = 0; i < node->fj_nNodes; i++)
appendStringInfo(str, (node->fj_alwaysDone[i]) ? "true" : "false");
@ -1284,15 +1284,15 @@ static void
_outStream(StringInfo str, Stream *node)
{
appendStringInfo(str,
" STREAM :pathptr @ 0x%x :cinfo @ 0x%x :clausetype %d :upstream @ 0x%x ",
(int) node->pathptr,
(int) node->cinfo,
(int) node->clausetype,
(int) node->upstream);
" STREAM :pathptr @ %p :cinfo @ %p :clausetype %p :upstream @ %p ",
node->pathptr,
node->cinfo,
node->clausetype,
node->upstream);
appendStringInfo(str,
" :downstream @ 0x%x :groupup %d :groupcost %f :groupsel %f ",
(int) node->downstream,
" :downstream @ %p :groupup %d :groupcost %f :groupsel %f ",
node->downstream,
node->groupup,
node->groupcost,
node->groupsel);

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/Attic/s_lock.c,v 1.24 2000/01/26 05:56:52 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/Attic/s_lock.c,v 1.25 2000/11/16 05:51:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -43,11 +43,11 @@ static void
s_lock_stuck(volatile slock_t *lock, const char *file, const int line)
{
fprintf(stderr,
"\nFATAL: s_lock(%08x) at %s:%d, stuck spinlock. Aborting.\n",
(unsigned int) lock, file, line);
"\nFATAL: s_lock(%p) at %s:%d, stuck spinlock. Aborting.\n",
lock, file, line);
fprintf(stdout,
"\nFATAL: s_lock(%08x) at %s:%d, stuck spinlock. Aborting.\n",
(unsigned int) lock, file, line);
"\nFATAL: s_lock(%p) at %s:%d, stuck spinlock. Aborting.\n",
lock, file, line);
abort();
}

View File

@ -11,7 +11,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/aset.c,v 1.31 2000/07/12 05:15:20 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/aset.c,v 1.32 2000/11/16 05:51:02 momjian Exp $
*
* NOTE:
* This is a new (Feb. 05, 1999) implementation of the allocation set
@ -876,8 +876,8 @@ AllocSetCheck(MemoryContext context)
* Check chunk size
*/
if (chsize < (1 << ALLOC_MINBITS))
elog(ERROR, "AllocSetCheck(): %s: bad size '%d' for chunk %p in block %p",
name, chsize, chunk, block);
elog(ERROR, "AllocSetCheck(): %s: bad size '%lu' for chunk %p in block %p",
name, (unsigned long)chsize, chunk, block);
/* single-chunk block */
if (chsize >= ALLOC_BIGCHUNK_LIMIT &&
@ -891,9 +891,9 @@ AllocSetCheck(MemoryContext context)
if (dsize < chsize && *chdata_end != 0x7F)
{
fprintf(stderr, "\n--- Leak %p ---\n", chdata_end);
fprintf(stderr, "Chunk dump size: %ld (chunk-header %ld + chunk-size: %d), data must be: %d\n--- dump begin ---\n",
fprintf(stderr, "Chunk dump size: %ld (chunk-header %ld + chunk-size: %lu), data must be: %lu\n--- dump begin ---\n",
chsize + ALLOC_CHUNKHDRSZ,
ALLOC_CHUNKHDRSZ, chsize, dsize);
ALLOC_CHUNKHDRSZ, (unsigned long)chsize, (unsigned long)dsize);
fwrite((void *) chunk, chsize+ALLOC_CHUNKHDRSZ, sizeof(char), stderr);
fputs("\n--- dump end ---\n", stderr);
@ -909,9 +909,9 @@ AllocSetCheck(MemoryContext context)
*chdata_end != 0x7F) {
fprintf(stderr, "\n--- Leak %p ---\n", chdata_end);
fprintf(stderr, "Dump size: %ld (chunk-header %ld + chunk-size: %d + block-freespace: %ld), data must be: %d\n--- dump begin ---\n",
fprintf(stderr, "Dump size: %ld (chunk-header %ld + chunk-size: %lu + block-freespace: %ld), data must be: %lu\n--- dump begin ---\n",
chsize + ALLOC_CHUNKHDRSZ + blk_free,
ALLOC_CHUNKHDRSZ, chsize, blk_free, dsize);
ALLOC_CHUNKHDRSZ, (unsigned long)chsize, blk_free, (unsigned long)dsize);
fwrite((void *) chunk, chsize+ALLOC_CHUNKHDRSZ+blk_free, sizeof(char), stderr);
fputs("\n--- dump end ---\n", stderr);

View File

@ -3,7 +3,7 @@
*
* Copyright 2000 by PostgreSQL Global Development Group
*
* $Header: /cvsroot/pgsql/src/bin/psql/print.c,v 1.13 2000/04/12 17:16:22 momjian Exp $
* $Header: /cvsroot/pgsql/src/bin/psql/print.c,v 1.14 2000/11/16 05:51:03 momjian Exp $
*/
#include "postgres.h"
#include "print.h"
@ -250,7 +250,7 @@ const char *opt_align, bool opt_barebones, unsigned short int opt_border,
if (strlen(title) >= total_w)
fprintf(fout, "%s\n", title);
else
fprintf(fout, "%-*s%s\n", (total_w - strlen(title)) / 2, "", title);
fprintf(fout, "%-*s%s\n", (int)(total_w - strlen(title)) / 2, "", title);
}
/* print headers */

View File

@ -1,5 +1,5 @@
#if defined(__i386__)
#define NEED_I386_TAS_ASM
typedef unsigned char slock_t;
#define HAS_TEST_AND_SET
#endif
@ -8,6 +8,11 @@
#define HAS_TEST_AND_SET
#endif
#if defined(__alpha__)
typedef long int slock_t;
#define HAS_TEST_AND_SET
#endif
#if defined(__vax__)
#define NEED_VAX_TAS_ASM
#define HAS_TEST_AND_SET
@ -25,5 +30,3 @@
#if defined(__mips__)
/* # undef HAS_TEST_AND_SET */
#endif
typedef unsigned char slock_t;

View File

@ -25,7 +25,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.41 2000/04/12 17:17:15 momjian Exp $
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.42 2000/11/16 05:51:05 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -209,7 +209,7 @@ pqGetnchar(char *s, size_t len, PGconn *conn)
conn->inCursor += len;
if (conn->Pfdebug)
fprintf(conn->Pfdebug, "From backend (%d)> %.*s\n", len, (int) len, s);
fprintf(conn->Pfdebug, "From backend (%lu)> %.*s\n", (unsigned long)len, (int) len, s);
return 0;
}
@ -260,13 +260,13 @@ pqGetInt(int *result, size_t bytes, PGconn *conn)
break;
default:
sprintf(noticeBuf,
"pqGetInt: int size %d not supported\n", bytes);
"pqGetInt: int size %lu not supported\n", (unsigned long)bytes);
DONOTICE(conn, noticeBuf);
return EOF;
}
if (conn->Pfdebug)
fprintf(conn->Pfdebug, "From backend (#%d)> %d\n", bytes, *result);
fprintf(conn->Pfdebug, "From backend (#%lu)> %d\n", (unsigned long)bytes, *result);
return 0;
}
@ -297,13 +297,13 @@ pqPutInt(int value, size_t bytes, PGconn *conn)
break;
default:
sprintf(noticeBuf,
"pqPutInt: int size %d not supported\n", bytes);
"pqPutInt: int size %lu not supported\n", (unsigned long)bytes);
DONOTICE(conn, noticeBuf);
return EOF;
}
if (conn->Pfdebug)
fprintf(conn->Pfdebug, "To backend (%d#)> %d\n", bytes, value);
fprintf(conn->Pfdebug, "To backend (%lu#)> %d\n", (unsigned long)bytes, value);
return 0;
}

View File

@ -1 +1,7 @@
CFLAGS='-O2 -m486 -pipe'
CFLAGS='-pipe'
case $host_cpu in
alpha*) CFLAGS="$CFLAGS -O";;
i386*) CFLAGS="$CFLAGS -O2";;
esac