Skip to content

Commit 6083a18

Browse files
authored
Merge pull request IvorySQL#1126 from OreoYang/CI_Warning_v5
IVORY_REL_5_STABLE: clear some build warnings
2 parents e9d96a8 + a1a2431 commit 6083a18

28 files changed

Lines changed: 113 additions & 87 deletions

File tree

‎.github/workflows/build.yml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ jobs:
1919
if: ${{ matrix.os == 'ubuntu-latest' }}
2020
run: |
2121
sudo apt-get update
22+
sudo apt-get install -y gcc-14 g++-14
23+
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100
24+
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
2225
sudo apt-get install -y build-essential git lcov bison flex \
2326
libkrb5-dev libssl-dev libldap-dev libpam-dev python3-dev \
2427
tcl-dev libperl-dev gettext libxml2-dev libxslt-dev \
@@ -35,4 +38,4 @@ jobs:
3538
--with-ossp-uuid --with-libxml --with-libxslt --with-perl \
3639
--with-icu --with-libnuma --enable-injection-points
3740
- name: compile
38-
run: make
41+
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"

‎contrib/gb18030_2022/utf8_and_gb18030_2022.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222

2323
PG_MODULE_MAGIC;
2424

25-
gb18030_2022_to_utf8_hook_type pre_gb18030_2022_to_utf8_hook = NULL;
26-
utf8_to_gb18030_2022_hook_type pre_utf8_to_gb18030_2022_hook = NULL;
25+
static gb18030_2022_to_utf8_hook_type pre_gb18030_2022_to_utf8_hook = NULL;
26+
static utf8_to_gb18030_2022_hook_type pre_utf8_to_gb18030_2022_hook = NULL;
2727

2828
int gb18030_2022_to_utf8(const unsigned char *iso, int len,
2929
unsigned char *utf, bool noError);

‎contrib/ivorysql_ora/src/builtin_functions/datetime_datatype_functions.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ static const int month_days[] = {
153153
31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
154154
};
155155

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

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

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

198-
const char *const date_timezone[] =
198+
static const char *const date_timezone[] =
199199
{
200200
"GMT", "ADT", "NST", "AST", "EDT", "CDT",
201201
"EST", "CST", "MDT", "MST", "PDT", "PST",

‎contrib/uuid-ossp/uuid-ossp.c‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -562,12 +562,20 @@ Datum
562562
ora_sys_guid(PG_FUNCTION_ARGS)
563563
{
564564
bytea *result;
565+
#ifdef HAVE_UUID_OSSP
566+
uuid_t *uuid;
567+
uuid_rc_t rc;
568+
#elif defined(HAVE_UUID_E2FS)
569+
uuid_t uu;
570+
#else /* BSD */
571+
int i;
572+
unsigned char byte_array[SYS_GUID_LENGTH];
573+
#endif
574+
565575
result = (bytea *)palloc(VARHDRSZ + SYS_GUID_LENGTH);
566576
SET_VARSIZE(result, VARHDRSZ + SYS_GUID_LENGTH);
567577

568578
#ifdef HAVE_UUID_OSSP
569-
uuid_t *uuid;
570-
uuid_rc_t rc;
571579
uuid = get_cached_uuid_t(0);
572580
rc = uuid_make(uuid, UUID_MAKE_V4, NULL, NULL);
573581
if (rc != UUID_RC_OK) {
@@ -576,17 +584,14 @@ ora_sys_guid(PG_FUNCTION_ARGS)
576584
memcpy(VARDATA(result), (unsigned char *)uuid, SYS_GUID_LENGTH);
577585

578586
#elif defined(HAVE_UUID_E2FS)
579-
uuid_t uu;
580587
uuid_generate_random(uu);
581588
memcpy(VARDATA(result), uu, SYS_GUID_LENGTH);
582589

583590
#else /* BSD */
584-
int i;
585-
unsigned char byte_array[SYS_GUID_LENGTH];
586591
for (i = 0; i < SYS_GUID_LENGTH; i++) {
587592
byte_array[i] = (unsigned char)arc4random();
588593
}
589594
memcpy(VARDATA(result), byte_array, SYS_GUID_LENGTH);
590595
#endif
591596
PG_RETURN_BYTEA_P(result);
592-
}
597+
}

‎src/backend/access/transam/xlog.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
#include "utils/memutils.h"
110110
#endif
111111

112-
extern int bootstrap_database_mode;
112+
113113
/* timeline ID to be used when bootstrapping */
114114
#define BootstrapTimeLineID 1
115115

‎src/backend/catalog/genbki.pl‎

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,10 +1118,27 @@ sub lookup_oids
11181118
push @lookupoids, $lookupname;
11191119
if ($lookupname eq '-' or $lookupname eq '0')
11201120
{
1121-
warn sprintf
1122-
"invalid zero OID reference in %s.dat field %s line %s\n",
1123-
$catname, $attname, $bki_values->{line_number}
1124-
if !$lookup_opt;
1121+
if (defined($bki_values->{type_name})
1122+
and $bki_values->{type_name} ne 'oracharchar'
1123+
and $bki_values->{type_name} ne 'oracharbyte'
1124+
and $bki_values->{type_name} ne 'oravarcharchar'
1125+
and $bki_values->{type_name} ne 'oravarcharbyte'
1126+
and $bki_values->{type_name} ne 'oradate'
1127+
and $bki_values->{type_name} ne 'oratimestamp'
1128+
and $bki_values->{type_name} ne 'oratimestamptz'
1129+
and $bki_values->{type_name} ne 'oratimestampltz'
1130+
and $bki_values->{type_name} ne 'yminterval'
1131+
and $bki_values->{type_name} ne 'dsinterval'
1132+
and $bki_values->{type_name} ne 'number'
1133+
and $bki_values->{type_name} ne 'binary_float'
1134+
and $bki_values->{type_name} ne 'binary_double'
1135+
)
1136+
{
1137+
warn sprintf
1138+
"invalid zero OID reference in %s.dat field %s line %s\n",
1139+
$catname, $attname, $bki_values->{line_number}
1140+
if !$lookup_opt;
1141+
}
11251142
}
11261143
else
11271144
{

‎src/backend/commands/sequence.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ typedef struct SeqTableData
9696
typedef SeqTableData *SeqTable;
9797

9898
static HTAB *seqhashtab = NULL; /* hash table for SeqTable items */
99-
int64 session_id = 0;
100-
int32 scale_value = 0;
99+
static int64 session_id = 0;
100+
static int32 scale_value = 0;
101101

102102
/*
103103
* last_used_seq is updated by nextval() to point to the last used
@@ -2399,7 +2399,7 @@ process_owned_by(Relation seqrel, List *owned_by, bool for_identity)
23992399
DependencyType deptype;
24002400
int nnames;
24012401
Relation tablerel;
2402-
AttrNumber attnum;
2402+
AttrNumber attnum = InvalidAttrNumber;
24032403
char *seqname;
24042404

24052405
deptype = for_identity ? DEPENDENCY_INTERNAL : DEPENDENCY_AUTO;

‎src/backend/commands/tablecmds.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15667,7 +15667,7 @@ RememberAllDependentForRebuilding(AlteredTableInfo *tab, AlterTableType subtype,
1566715667
ScanKeyData key[3];
1566815668
SysScanDesc scan;
1566915669
HeapTuple depTup;
15670-
ObjectFunOrPkg *dependentFuncPkgOids;
15670+
ObjectFunOrPkg *dependentFuncPkgOids = NULL;
1567115671
bool FuncPkgDepend = false;
1567215672

1567315673
if(NULL != numDependentFuncPkgOids &&
@@ -15678,6 +15678,7 @@ RememberAllDependentForRebuilding(AlteredTableInfo *tab, AlterTableType subtype,
1567815678
dependentFuncPkgOids = *dependentFuncPkg;
1567915679
}
1568015680

15681+
1568115682
Assert(subtype == AT_AlterColumnType || subtype == AT_SetExpression);
1568215683

1568315684
depRel = table_open(DependRelationId, RowExclusiveLock);

‎src/backend/executor/execExpr.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5112,7 +5112,7 @@ ExecInitFuncWithOutParams(Expr *node, ExprState *state,
51125112
{
51135113
FuncExpr *funcexpr = (FuncExpr *) node;
51145114
Oid funcOid = funcexpr->funcid;
5115-
HeapTuple func_tuple;
5115+
HeapTuple func_tuple = NULL;
51165116
Oid *argtypes = NULL;
51175117
char **argnames = NULL;
51185118
char *argmodes = NULL;

‎src/backend/oracle_parser/liboracle_parser.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ PG_MODULE_MAGIC_EXT(
4949
static raw_parser_hook_type prev_raw_parser = NULL;
5050
static get_keywords_hook_type prev_pg_get_keywords = NULL;
5151
static fill_in_constant_lengths_hook_type prev_fill_in_contant_lengths = NULL;
52-
quote_identifier_hook_type prev_quote_identifier = NULL;
52+
static quote_identifier_hook_type prev_quote_identifier = NULL;
5353

5454
void _PG_init(void);
5555
void _PG_fini(void);

0 commit comments

Comments
 (0)