]> granicus.if.org Git - postgresql/commitdiff
Make pgsql compile on FreeBSD-alpha.
authorBruce Momjian <bruce@momjian.us>
Thu, 16 Nov 2000 05:51:07 +0000 (05:51 +0000)
committerBruce Momjian <bruce@momjian.us>
Thu, 16 Nov 2000 05:51:07 +0000 (05:51 +0000)
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

14 files changed:
src/backend/access/common/indextuple.c
src/backend/access/heap/hio.c
src/backend/access/nbtree/nbtinsert.c
src/backend/access/nbtree/nbtsort.c
src/backend/access/transam/xlog.c
src/backend/commands/vacuum.c
src/backend/main/main.c
src/backend/nodes/outfuncs.c
src/backend/storage/buffer/s_lock.c
src/backend/utils/mmgr/aset.c
src/bin/psql/print.c
src/include/port/freebsd.h
src/interfaces/libpq/fe-misc.c
src/template/freebsd

index b4dc69df26978ae40b0936868a341ce7979d06a3..15ed18245607afd8380c783e817e2eba562d69d3 100644 (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;
 
index 04725b4a7b471c4f140ac7d9de0a3aa60537af0d..43a94c4c1e31137566d99eb3f61cfede67d1346f 100644 (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);
                }
        }
 
index 4b92f2f56112e9fa79865a490b757b665c2e60e9..6d287fb79bcda6ae941aab848aead2df2ad471e9 100644 (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));
 
        /*
index b52522fa8de8f8ab939add48d5f630f5ac654df5..e3e3bc04e90480b7592796ec81d9ea0e5eccefcb 100644 (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)
index 6d7112ceaf1b608dcef910b480e889f4817c1aee..b85c39cb80e5add750859e9d12f2d9ab70ba72ae 100644 (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;
index 3976cb1ab50cf82ffebe8cfbb9b48f7bea4de0fd..403d80942de0af867a5b1bb8ee24059480c279f0 100644 (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);
index 9e2543b3b144e0c5b84e0b614f0398184761a080..475050097dcc9813cf58593524fa47ec13411f27 100644 (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
index d7137f10ace4b85e25f08541e60d600804c5c278..db318a1b31275555b38d4ffc9762e433c9dd4b9e 100644 (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);
index fae4ab3c934407f332649433ac4c8575bc4e9946..883c150b92384ed83b2e9cbe1f009abba5aadba0 100644 (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();
 }
 
index 12affe6731faad5ed1e526f6f4261bcb4d7ec23d..b5f552647eff486f3a04a97b5c591b7fb373653c 100644 (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);
index b94b90ba36ff1e963dba249657471526786e5718..a94ac19909160ed39563a31ea5369eb671a61343 100644 (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 */
index ec92644a15ee478d0076cb8f6cb1e77b6d432a61..a8eeac760c1143faeac4181a038fa87329d5239f 100644 (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;
index d7f1b6e1549dac24e749047db7a10e0206dbf772..fff8ee6da97afdba2bf9e4a0a0acb358476bede3 100644 (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;
 }
index c3706a6517668fb9489b7337df313edc9065f321..9e92126332b6cc5ab88a94353a6b148f6d7b38b3 100644 (file)
@@ -1 +1,7 @@
-CFLAGS='-O2 -m486 -pipe'
+CFLAGS='-pipe'
+
+case $host_cpu in
+  alpha*)   CFLAGS="$CFLAGS -O";;
+  i386*)    CFLAGS="$CFLAGS -O2";;
+esac
+