Skip to content

Commit 312063c

Browse files
committed
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
1 parent 580d2bc commit 312063c

File tree

14 files changed

+69
-58
lines changed

14 files changed

+69
-58
lines changed

src/backend/access/common/indextuple.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.45 2000/09/23 22:40:12 tgl Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.46 2000/11/16 05:50:57 momjian Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -139,7 +139,8 @@ index_formtuple(TupleDesc tupleDescriptor,
139139
*/
140140

141141
if ((size & INDEX_SIZE_MASK) != size)
142-
elog(ERROR, "index_formtuple: data takes %d bytes: too big", size);
142+
elog(ERROR, "index_formtuple: data takes %lu bytes: too big",
143+
(unsigned long)size);
143144

144145
infomask |= size;
145146

src/backend/access/heap/hio.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Id: hio.c,v 1.33 2000/09/07 09:58:35 vadim Exp $
11+
* $Id: hio.c,v 1.34 2000/11/16 05:50:58 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -91,8 +91,8 @@ RelationGetBufferForTuple(Relation relation, Size len)
9191
* If we're gonna fail for oversize tuple, do it right away
9292
*/
9393
if (len > MaxTupleSize)
94-
elog(ERROR, "Tuple is too big: size %u, max size %ld",
95-
len, MaxTupleSize);
94+
elog(ERROR, "Tuple is too big: size %lu, max size %ld",
95+
(unsigned long)len, MaxTupleSize);
9696

9797
if (!relation->rd_myxactonly)
9898
LockPage(relation, 0, ExclusiveLock);
@@ -139,7 +139,8 @@ RelationGetBufferForTuple(Relation relation, Size len)
139139
if (len > PageGetFreeSpace(pageHeader))
140140
{
141141
/* We should not get here given the test at the top */
142-
elog(STOP, "Tuple is too big: size %u", len);
142+
elog(STOP, "Tuple is too big: size %lu",
143+
(unsigned long)len);
143144
}
144145
}
145146

src/backend/access/nbtree/nbtinsert.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.67 2000/10/21 15:43:18 vadim Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.68 2000/11/16 05:50:58 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -348,8 +348,8 @@ _bt_insertonpg(Relation rel,
348348
* itemsz doesn't include the ItemId.
349349
*/
350350
if (itemsz > (PageGetPageSize(page) - sizeof(PageHeaderData) - MAXALIGN(sizeof(BTPageOpaqueData))) / 3 - sizeof(ItemIdData))
351-
elog(ERROR, "btree: index item size %u exceeds maximum %lu",
352-
itemsz,
351+
elog(ERROR, "btree: index item size %lu exceeds maximum %lu",
352+
(unsigned long)itemsz,
353353
(PageGetPageSize(page) - sizeof(PageHeaderData) - MAXALIGN(sizeof(BTPageOpaqueData))) /3 - sizeof(ItemIdData));
354354

355355
/*

src/backend/access/nbtree/nbtsort.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
* Portions Copyright (c) 1994, Regents of the University of California
3636
*
3737
* IDENTIFICATION
38-
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsort.c,v 1.57 2000/08/10 02:33:20 inoue Exp $
38+
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsort.c,v 1.58 2000/11/16 05:50:58 momjian Exp $
3939
*
4040
*-------------------------------------------------------------------------
4141
*/
@@ -346,8 +346,8 @@ _bt_buildadd(Relation index, BTPageState *state, BTItem bti)
346346
* during creation of an index, we don't go through there.
347347
*/
348348
if (btisz > (PageGetPageSize(npage) - sizeof(PageHeaderData) - MAXALIGN(sizeof(BTPageOpaqueData))) / 3 - sizeof(ItemIdData))
349-
elog(ERROR, "btree: index item size %d exceeds maximum %ld",
350-
btisz,
349+
elog(ERROR, "btree: index item size %lu exceeds maximum %ld",
350+
(unsigned long)btisz,
351351
(PageGetPageSize(npage) - sizeof(PageHeaderData) - MAXALIGN(sizeof(BTPageOpaqueData))) /3 - sizeof(ItemIdData));
352352

353353
if (pgspc < btisz || pgspc < state->btps_full)

src/backend/access/transam/xlog.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.25 2000/11/09 11:25:58 vadim Exp $
9+
* $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.26 2000/11/16 05:50:59 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -1274,7 +1274,6 @@ BootStrapXLOG()
12741274
int fd;
12751275
char buffer[BLCKSZ];
12761276
CheckPoint checkPoint;
1277-
bool usexistent = false;
12781277

12791278
#ifdef XLOG
12801279
XLogPageHeader page = (XLogPageHeader) buffer;

src/backend/commands/vacuum.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.171 2000/10/28 16:20:54 vadim Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.172 2000/11/16 05:50:59 momjian Exp $
1212
*
1313
1414
*-------------------------------------------------------------------------
@@ -950,12 +950,13 @@ scan_heap(VRelStats *vacrelstats, Relation onerel,
950950
}
951951

952952
elog(MESSAGE_LEVEL, "Pages %u: Changed %u, reaped %u, Empty %u, New %u; \
953-
Tup %u: Vac %u, Keep/VTL %u/%u, Crash %u, UnUsed %u, MinLen %u, MaxLen %u; \
954-
Re-using: Free/Avail. Space %u/%u; EndEmpty/Avail. Pages %u/%u. %s",
953+
Tup %u: Vac %u, Keep/VTL %u/%u, Crash %u, UnUsed %u, MinLen %lu, MaxLen %lu; \
954+
Re-using: Free/Avail. Space %lu/%lu; EndEmpty/Avail. Pages %u/%u. %s",
955955
nblocks, changed_pages, vacuum_pages->num_pages, empty_pages,
956956
new_pages, num_tuples, tups_vacuumed,
957957
nkeep, vacrelstats->num_vtlinks, ncrash,
958-
nunused, min_tlen, max_tlen, free_size, usable_free_size,
958+
nunused, (unsigned long)min_tlen, (unsigned long)max_tlen,
959+
(unsigned long)free_size, (unsigned long)usable_free_size,
959960
empty_end_pages, fraged_pages->num_pages,
960961
show_rusage(&ru0));
961962

@@ -1484,8 +1485,8 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
14841485
InvalidOffsetNumber, LP_USED);
14851486
if (newoff == InvalidOffsetNumber)
14861487
{
1487-
elog(STOP, "moving chain: failed to add item with len = %u to page %u",
1488-
tuple_len, destvacpage->blkno);
1488+
elog(STOP, "moving chain: failed to add item with len = %lu to page %u",
1489+
(unsigned long)tuple_len, destvacpage->blkno);
14891490
}
14901491
newitemid = PageGetItemId(ToPage, newoff);
14911492
pfree(newtup.t_data);
@@ -1636,8 +1637,8 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
16361637
if (newoff == InvalidOffsetNumber)
16371638
{
16381639
elog(ERROR, "\
1639-
failed to add item with len = %u to page %u (free space %u, nusd %u, noff %u)",
1640-
tuple_len, cur_page->blkno, cur_page->free,
1640+
failed to add item with len = %lu to page %u (free space %lu, nusd %u, noff %u)",
1641+
(unsigned long)tuple_len, cur_page->blkno, (unsigned long)cur_page->free,
16411642
cur_page->offsets_used, cur_page->offsets_free);
16421643
}
16431644
newitemid = PageGetItemId(ToPage, newoff);

src/backend/main/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/main/main.c,v 1.33 2000/10/21 22:36:11 petere Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/main/main.c,v 1.34 2000/11/16 05:51:00 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -17,7 +17,7 @@
1717
#include <pwd.h>
1818
#include <unistd.h>
1919

20-
#if defined(__alpha) && !defined(linux)
20+
#if defined(__alpha) && !defined(linux) && !defined(__FreeBSD__)
2121
#include <sys/sysinfo.h>
2222
#include "machine/hal_sysinfo.h"
2323
#define ASSEMBLER

src/backend/nodes/outfuncs.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.132 2000/11/12 00:36:57 tgl Exp $
9+
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.133 2000/11/16 05:51:00 momjian Exp $
1010
*
1111
* NOTES
1212
* Every (plan) node in POSTGRES has an associated "out" routine which
@@ -688,8 +688,8 @@ _outFjoin(StringInfo str, Fjoin *node)
688688
appendStringInfo(str, " :innerNode ");
689689
_outNode(str, node->fj_innerNode);
690690

691-
appendStringInfo(str, " :results @ 0x%x :alwaysdone",
692-
(int) node->fj_results);
691+
appendStringInfo(str, " :results @ 0x%p :alwaysdone",
692+
node->fj_results);
693693

694694
for (i = 0; i < node->fj_nNodes; i++)
695695
appendStringInfo(str, (node->fj_alwaysDone[i]) ? "true" : "false");
@@ -1284,15 +1284,15 @@ static void
12841284
_outStream(StringInfo str, Stream *node)
12851285
{
12861286
appendStringInfo(str,
1287-
" STREAM :pathptr @ 0x%x :cinfo @ 0x%x :clausetype %d :upstream @ 0x%x ",
1288-
(int) node->pathptr,
1289-
(int) node->cinfo,
1290-
(int) node->clausetype,
1291-
(int) node->upstream);
1287+
" STREAM :pathptr @ %p :cinfo @ %p :clausetype %p :upstream @ %p ",
1288+
node->pathptr,
1289+
node->cinfo,
1290+
node->clausetype,
1291+
node->upstream);
12921292

12931293
appendStringInfo(str,
1294-
" :downstream @ 0x%x :groupup %d :groupcost %f :groupsel %f ",
1295-
(int) node->downstream,
1294+
" :downstream @ %p :groupup %d :groupcost %f :groupsel %f ",
1295+
node->downstream,
12961296
node->groupup,
12971297
node->groupcost,
12981298
node->groupsel);

src/backend/storage/buffer/s_lock.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/Attic/s_lock.c,v 1.24 2000/01/26 05:56:52 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/Attic/s_lock.c,v 1.25 2000/11/16 05:51:01 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -43,11 +43,11 @@ static void
4343
s_lock_stuck(volatile slock_t *lock, const char *file, const int line)
4444
{
4545
fprintf(stderr,
46-
"\nFATAL: s_lock(%08x) at %s:%d, stuck spinlock. Aborting.\n",
47-
(unsigned int) lock, file, line);
46+
"\nFATAL: s_lock(%p) at %s:%d, stuck spinlock. Aborting.\n",
47+
lock, file, line);
4848
fprintf(stdout,
49-
"\nFATAL: s_lock(%08x) at %s:%d, stuck spinlock. Aborting.\n",
50-
(unsigned int) lock, file, line);
49+
"\nFATAL: s_lock(%p) at %s:%d, stuck spinlock. Aborting.\n",
50+
lock, file, line);
5151
abort();
5252
}
5353

src/backend/utils/mmgr/aset.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Portions Copyright (c) 1994, Regents of the University of California
1212
*
1313
* IDENTIFICATION
14-
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/aset.c,v 1.31 2000/07/12 05:15:20 tgl Exp $
14+
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/aset.c,v 1.32 2000/11/16 05:51:02 momjian Exp $
1515
*
1616
* NOTE:
1717
* This is a new (Feb. 05, 1999) implementation of the allocation set
@@ -876,8 +876,8 @@ AllocSetCheck(MemoryContext context)
876876
* Check chunk size
877877
*/
878878
if (chsize < (1 << ALLOC_MINBITS))
879-
elog(ERROR, "AllocSetCheck(): %s: bad size '%d' for chunk %p in block %p",
880-
name, chsize, chunk, block);
879+
elog(ERROR, "AllocSetCheck(): %s: bad size '%lu' for chunk %p in block %p",
880+
name, (unsigned long)chsize, chunk, block);
881881

882882
/* single-chunk block */
883883
if (chsize >= ALLOC_BIGCHUNK_LIMIT &&
@@ -891,9 +891,9 @@ AllocSetCheck(MemoryContext context)
891891
if (dsize < chsize && *chdata_end != 0x7F)
892892
{
893893
fprintf(stderr, "\n--- Leak %p ---\n", chdata_end);
894-
fprintf(stderr, "Chunk dump size: %ld (chunk-header %ld + chunk-size: %d), data must be: %d\n--- dump begin ---\n",
894+
fprintf(stderr, "Chunk dump size: %ld (chunk-header %ld + chunk-size: %lu), data must be: %lu\n--- dump begin ---\n",
895895
chsize + ALLOC_CHUNKHDRSZ,
896-
ALLOC_CHUNKHDRSZ, chsize, dsize);
896+
ALLOC_CHUNKHDRSZ, (unsigned long)chsize, (unsigned long)dsize);
897897

898898
fwrite((void *) chunk, chsize+ALLOC_CHUNKHDRSZ, sizeof(char), stderr);
899899
fputs("\n--- dump end ---\n", stderr);
@@ -909,9 +909,9 @@ AllocSetCheck(MemoryContext context)
909909
*chdata_end != 0x7F) {
910910

911911
fprintf(stderr, "\n--- Leak %p ---\n", chdata_end);
912-
fprintf(stderr, "Dump size: %ld (chunk-header %ld + chunk-size: %d + block-freespace: %ld), data must be: %d\n--- dump begin ---\n",
912+
fprintf(stderr, "Dump size: %ld (chunk-header %ld + chunk-size: %lu + block-freespace: %ld), data must be: %lu\n--- dump begin ---\n",
913913
chsize + ALLOC_CHUNKHDRSZ + blk_free,
914-
ALLOC_CHUNKHDRSZ, chsize, blk_free, dsize);
914+
ALLOC_CHUNKHDRSZ, (unsigned long)chsize, blk_free, (unsigned long)dsize);
915915

916916
fwrite((void *) chunk, chsize+ALLOC_CHUNKHDRSZ+blk_free, sizeof(char), stderr);
917917
fputs("\n--- dump end ---\n", stderr);

src/bin/psql/print.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright 2000 by PostgreSQL Global Development Group
55
*
6-
* $Header: /cvsroot/pgsql/src/bin/psql/print.c,v 1.13 2000/04/12 17:16:22 momjian Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/print.c,v 1.14 2000/11/16 05:51:03 momjian Exp $
77
*/
88
#include "postgres.h"
99
#include "print.h"
@@ -250,7 +250,7 @@ const char *opt_align, bool opt_barebones, unsigned short int opt_border,
250250
if (strlen(title) >= total_w)
251251
fprintf(fout, "%s\n", title);
252252
else
253-
fprintf(fout, "%-*s%s\n", (total_w - strlen(title)) / 2, "", title);
253+
fprintf(fout, "%-*s%s\n", (int)(total_w - strlen(title)) / 2, "", title);
254254
}
255255

256256
/* print headers */

src/include/port/freebsd.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#if defined(__i386__)
2-
#define NEED_I386_TAS_ASM
2+
typedef unsigned char slock_t;
33
#define HAS_TEST_AND_SET
44
#endif
55

@@ -8,6 +8,11 @@
88
#define HAS_TEST_AND_SET
99
#endif
1010

11+
#if defined(__alpha__)
12+
typedef long int slock_t;
13+
#define HAS_TEST_AND_SET
14+
#endif
15+
1116
#if defined(__vax__)
1217
#define NEED_VAX_TAS_ASM
1318
#define HAS_TEST_AND_SET
@@ -25,5 +30,3 @@
2530
#if defined(__mips__)
2631
/* # undef HAS_TEST_AND_SET */
2732
#endif
28-
29-
typedef unsigned char slock_t;

src/interfaces/libpq/fe-misc.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
*
2626
*
2727
* IDENTIFICATION
28-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.41 2000/04/12 17:17:15 momjian Exp $
28+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.42 2000/11/16 05:51:05 momjian Exp $
2929
*
3030
*-------------------------------------------------------------------------
3131
*/
@@ -209,7 +209,7 @@ pqGetnchar(char *s, size_t len, PGconn *conn)
209209
conn->inCursor += len;
210210

211211
if (conn->Pfdebug)
212-
fprintf(conn->Pfdebug, "From backend (%d)> %.*s\n", len, (int) len, s);
212+
fprintf(conn->Pfdebug, "From backend (%lu)> %.*s\n", (unsigned long)len, (int) len, s);
213213

214214
return 0;
215215
}
@@ -260,13 +260,13 @@ pqGetInt(int *result, size_t bytes, PGconn *conn)
260260
break;
261261
default:
262262
sprintf(noticeBuf,
263-
"pqGetInt: int size %d not supported\n", bytes);
263+
"pqGetInt: int size %lu not supported\n", (unsigned long)bytes);
264264
DONOTICE(conn, noticeBuf);
265265
return EOF;
266266
}
267267

268268
if (conn->Pfdebug)
269-
fprintf(conn->Pfdebug, "From backend (#%d)> %d\n", bytes, *result);
269+
fprintf(conn->Pfdebug, "From backend (#%lu)> %d\n", (unsigned long)bytes, *result);
270270

271271
return 0;
272272
}
@@ -297,13 +297,13 @@ pqPutInt(int value, size_t bytes, PGconn *conn)
297297
break;
298298
default:
299299
sprintf(noticeBuf,
300-
"pqPutInt: int size %d not supported\n", bytes);
300+
"pqPutInt: int size %lu not supported\n", (unsigned long)bytes);
301301
DONOTICE(conn, noticeBuf);
302302
return EOF;
303303
}
304304

305305
if (conn->Pfdebug)
306-
fprintf(conn->Pfdebug, "To backend (%d#)> %d\n", bytes, value);
306+
fprintf(conn->Pfdebug, "To backend (%lu#)> %d\n", (unsigned long)bytes, value);
307307

308308
return 0;
309309
}

src/template/freebsd

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
CFLAGS='-O2 -m486 -pipe'
1+
CFLAGS='-pipe'
2+
3+
case $host_cpu in
4+
alpha*) CFLAGS="$CFLAGS -O";;
5+
i386*) CFLAGS="$CFLAGS -O2";;
6+
esac
7+

0 commit comments

Comments
 (0)