Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ jobs:
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt-get update
sudo apt-get install -y gcc-14 g++-14
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
sudo apt-get install -y build-essential git lcov bison flex \
libkrb5-dev libssl-dev libldap-dev libpam-dev python3-dev \
tcl-dev libperl-dev gettext libxml2-dev libxslt-dev \
Expand All @@ -35,4 +38,4 @@ jobs:
--with-ossp-uuid --with-libxml --with-libxslt --with-perl \
--with-icu --with-libnuma --enable-injection-points
- name: compile
run: make
run: make CFLAGS="$CFLAGS -Wshadow=compatible-local -Werror=missing-variable-declarations -Werror=maybe-uninitialized -Werror=unused-value -Werror=unused-but-set-variable -Werror=missing-prototypes -Werror=unused-variable"
4 changes: 2 additions & 2 deletions contrib/gb18030_2022/utf8_and_gb18030_2022.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

PG_MODULE_MAGIC;

gb18030_2022_to_utf8_hook_type pre_gb18030_2022_to_utf8_hook = NULL;
utf8_to_gb18030_2022_hook_type pre_utf8_to_gb18030_2022_hook = NULL;
static gb18030_2022_to_utf8_hook_type pre_gb18030_2022_to_utf8_hook = NULL;
static utf8_to_gb18030_2022_hook_type pre_utf8_to_gb18030_2022_hook = NULL;

int gb18030_2022_to_utf8(const unsigned char *iso, int len,
unsigned char *utf, bool noError);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ static const int month_days[] = {
31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
};

const char *const ora_days[] = {"Sunday", "Monday", "Tuesday", "Wednesday",
static const char *const ora_days[] = {"Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday", NULL};

#define CASE_fmt_YYYY case 0: case 1: case 2: case 3: case 4: case 5: case 6:
Expand All @@ -169,7 +169,7 @@ const char *const ora_days[] = {"Sunday", "Monday", "Tuesday", "Wednesday",
#define CASE_fmt_HH case 27: case 28: case 29:
#define CASE_fmt_MI case 30:

const char *const date_fmt[] =
static const char *const date_fmt[] =
{
"Y", "Yy", "Yyy", "Yyyy", "Year", "Syyyy", "syear",
"I", "Iy", "Iyy", "Iyyy",
Expand All @@ -195,7 +195,7 @@ const char *const date_fmt[] =
#define CASE_timezone_10 case 15: case 16:
#define CASE_timezone_11 case 17:

const char *const date_timezone[] =
static const char *const date_timezone[] =
{
"GMT", "ADT", "NST", "AST", "EDT", "CDT",
"EST", "CST", "MDT", "MST", "PDT", "PST",
Expand Down
8 changes: 5 additions & 3 deletions contrib/uuid-ossp/uuid-ossp.c
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,11 @@ ora_sys_guid(PG_FUNCTION_ARGS)
#ifdef HAVE_UUID_OSSP
uuid_t *uuid;
uuid_rc_t rc;
#elif defined(HAVE_UUID_E2FS)
uuid_t uu;
#else /* BSD */
int i;
unsigned char byte_array[SYS_GUID_LENGTH];
#endif

result = (bytea *)palloc(VARHDRSZ + SYS_GUID_LENGTH);
Expand All @@ -579,13 +584,10 @@ ora_sys_guid(PG_FUNCTION_ARGS)
memcpy(VARDATA(result), (unsigned char *)uuid, SYS_GUID_LENGTH);

#elif defined(HAVE_UUID_E2FS)
uuid_t uu;
uuid_generate_random(uu);
memcpy(VARDATA(result), uu, SYS_GUID_LENGTH);

#else /* BSD */
int i;
unsigned char byte_array[SYS_GUID_LENGTH];
for (i = 0; i < SYS_GUID_LENGTH; i++) {
byte_array[i] = (unsigned char)arc4random();
}
Expand Down
2 changes: 1 addition & 1 deletion src/backend/access/transam/xlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
#include "utils/memutils.h"
#endif

extern int bootstrap_database_mode;

/* timeline ID to be used when bootstrapping */
#define BootstrapTimeLineID 1

Expand Down
6 changes: 3 additions & 3 deletions src/backend/commands/sequence.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ typedef struct SeqTableData
typedef SeqTableData *SeqTable;

static HTAB *seqhashtab = NULL; /* hash table for SeqTable items */
int64 session_id = 0;
int32 scale_value = 0;
static int64 session_id = 0;
static int32 scale_value = 0;

/*
* last_used_seq is updated by nextval() to point to the last used
Expand Down Expand Up @@ -2399,7 +2399,7 @@ process_owned_by(Relation seqrel, List *owned_by, bool for_identity)
DependencyType deptype;
int nnames;
Relation tablerel;
AttrNumber attnum;
AttrNumber attnum = InvalidAttrNumber;
char *seqname;

deptype = for_identity ? DEPENDENCY_INTERNAL : DEPENDENCY_AUTO;
Expand Down
3 changes: 2 additions & 1 deletion src/backend/commands/tablecmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -15642,7 +15642,7 @@ RememberAllDependentForRebuilding(AlteredTableInfo *tab, AlterTableType subtype,
ScanKeyData key[3];
SysScanDesc scan;
HeapTuple depTup;
ObjectFunOrPkg *dependentFuncPkgOids;
ObjectFunOrPkg *dependentFuncPkgOids = NULL;
bool FuncPkgDepend = false;

if(NULL != numDependentFuncPkgOids &&
Expand All @@ -15653,6 +15653,7 @@ RememberAllDependentForRebuilding(AlteredTableInfo *tab, AlterTableType subtype,
dependentFuncPkgOids = *dependentFuncPkg;
}


Assert(subtype == AT_AlterColumnType || subtype == AT_SetExpression);

depRel = table_open(DependRelationId, RowExclusiveLock);
Expand Down
2 changes: 1 addition & 1 deletion src/backend/executor/execExpr.c
Original file line number Diff line number Diff line change
Expand Up @@ -5112,7 +5112,7 @@ ExecInitFuncWithOutParams(Expr *node, ExprState *state,
{
FuncExpr *funcexpr = (FuncExpr *) node;
Oid funcOid = funcexpr->funcid;
HeapTuple func_tuple;
HeapTuple func_tuple = NULL;
Oid *argtypes = NULL;
char **argnames = NULL;
char *argmodes = NULL;
Expand Down
2 changes: 1 addition & 1 deletion src/backend/oracle_parser/liboracle_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ PG_MODULE_MAGIC_EXT(
static raw_parser_hook_type prev_raw_parser = NULL;
static get_keywords_hook_type prev_pg_get_keywords = NULL;
static fill_in_constant_lengths_hook_type prev_fill_in_contant_lengths = NULL;
quote_identifier_hook_type prev_quote_identifier = NULL;
static quote_identifier_hook_type prev_quote_identifier = NULL;

void _PG_init(void);
void _PG_fini(void);
Expand Down
4 changes: 2 additions & 2 deletions src/backend/parser/parse_param.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ typedef struct OraParamNumbers
struct OraParamNumbers* prev;
}OraParamNumbers;

OraParamNumbers *TopOraParamNode = NULL;
OraParamNumbers *CurrentOraParamNode = NULL;
static OraParamNumbers *TopOraParamNode = NULL;
static OraParamNumbers *CurrentOraParamNode = NULL;

/*
* dynamic sql stmt parse information
Expand Down
7 changes: 3 additions & 4 deletions src/backend/utils/adt/ruleutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -14410,7 +14410,6 @@ pg_get_function_arg_reference_typerowtype_internal(Tuplestorestate **tupstore,
{
RangeVar *rel = makeRangeVar(NULL, NULL, typeName->location);
char *field = NULL;
Oid relid_1;
AttrNumber attnum;

/* deconstruct the name list */
Expand Down Expand Up @@ -14447,12 +14446,12 @@ pg_get_function_arg_reference_typerowtype_internal(Tuplestorestate **tupstore,
break;
}

relid_1 = RangeVarGetRelid(rel, NoLock, true);
attnum = get_attnum(relid_1, field);
relid = RangeVarGetRelid(rel, NoLock, true);
attnum = get_attnum(relid, field);

if (attnum != InvalidAttrNumber)
{
get_atttypetypmodcoll(relid_1, attnum,
get_atttypetypmodcoll(relid, attnum,
&fieldTypeId, &fieldTypMod, &fieldCollation);

/* this construct should never have an array indicator */
Expand Down
6 changes: 3 additions & 3 deletions src/backend/utils/misc/ivy_guc.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ int identifier_case_switch = INTERCHANGE;
bool identifier_case_from_pg_dump = false;
bool enable_case_switch = true;

char *nls_territory = "AMERICA";
char *nls_currency = "$";
char *nls_iso_currency = "AMERICA";
static char *nls_territory = "AMERICA";
static char *nls_currency = "$";
static char *nls_iso_currency = "AMERICA";

bool enable_emptystring_to_NULL = false;

Expand Down
2 changes: 1 addition & 1 deletion src/bin/pg_dump/pg_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -18970,7 +18970,7 @@ dumpSequence(Archive *fout, const TableInfo *tbinfo)
default_minv = is_ascending ? 1 : PG_INT64_MIN;
default_maxv = is_ascending ? PG_INT64_MAX : -1;
}
else if (db_mode == DB_PG)
else
{
pg_fatal("unrecognized sequence type: %d", seq->seqtype);
default_minv = default_maxv = 0; /* keep compiler quiet */
Expand Down
24 changes: 11 additions & 13 deletions src/bin/psql/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -3601,7 +3601,6 @@ get_hostvariables(const char *sql, bool *error)
HostVariable *host = NULL;
char *newsql = NULL;
char *ptr = NULL;
int j = 0;

*error = false;
if (!sql)
Expand All @@ -3610,12 +3609,13 @@ get_hostvariables(const char *sql, bool *error)
/* double write quote */
newsql = pg_malloc0(strlen(sql) * 2); /* enough */
ptr = newsql;
while (sql[j] != '\0')

while (*sql != '\0')
{
if (sql[j] == '\'')
*ptr++ = sql[j];
*ptr++ = sql[j];
j++;
if (*sql == '\'')
*ptr++ = *sql;
*ptr++ = *sql;
sql++;
}
*ptr = '\0';

Expand Down Expand Up @@ -3695,7 +3695,6 @@ SendQuery_PBE(const char *query, HostVariable *hv)
PGTransactionStatusType transaction_status;
double elapsed_msec = 0;
bool OK = false;
int i = 0;
bool on_error_rollback_savepoint = false;
static bool on_error_rollback_warning = false;

Expand Down Expand Up @@ -3802,7 +3801,6 @@ SendQuery_PBE(const char *query, HostVariable *hv)
struct _variable **bindvar;
char *p = NULL;
bool missing = false;
int j;
instr_time before,
after;

Expand All @@ -3816,13 +3814,13 @@ SendQuery_PBE(const char *query, HostVariable *hv)
* the order of detection in the Oracle error message is from the
* back to the front.
*/
for (j = hv->length; j > 0; j--)
for (int i = hv->length; i > 0; i--)
{
p = hv->hostvars[j - 1].name;
p = hv->hostvars[i - 1].name;
p++; /* skip colon */
bindvar[j - 1] = BindVariableExist(pset.vars, p);
bindvar[i - 1] = BindVariableExist(pset.vars, p);

if (bindvar[j - 1] == NULL)
if (bindvar[i - 1] == NULL)
{
missing= true;
break;
Expand Down Expand Up @@ -4004,7 +4002,7 @@ SendQuery_PBE(const char *query, HostVariable *hv)

/* reset \crosstabview trigger */
pset.crosstab_flag = false;
for (i = 0; i < lengthof(pset.ctv_args); i++)
for (int i = 0; i < lengthof(pset.ctv_args); i++)
{
pg_free(pset.ctv_args[i]);
pset.ctv_args[i] = NULL;
Expand Down
2 changes: 1 addition & 1 deletion src/bin/psql/psqlplusscan.l
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static const PsqlScanKeyword psqlplus_keywords[] = {
PSQL_KEYWORD("variable", K_VARIABLE, UNRESERVED_PSQL_KEYWORD)
};

const int NumKeywords = lengthof(psqlplus_keywords);
static const int NumKeywords = lengthof(psqlplus_keywords);

/*
* Set the type of YYSTYPE.
Expand Down
4 changes: 2 additions & 2 deletions src/bin/psql/startup.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,8 @@ main(int argc, char *argv[])
}
else if (cell->action == ACT_SINGLE_SLASH)
{
PsqlScanState scan_state;
ConditionalStack cond_stack;
PsqlScanState scan_state = NULL;
ConditionalStack cond_stack = NULL;

pg_logging_config(PG_LOG_FLAG_TERSE);

Expand Down
2 changes: 1 addition & 1 deletion src/include/utils/ora_compatible.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ typedef enum
NLS_LENGTH_BYTE,
NLS_LENGTH_CHAR
} NlsLengthSemantics;

extern int bootstrap_database_mode;
#endif /* ORA_COMPATIBLE_H */
Loading