Skip to content

Commit d4fc7eb

Browse files
author
Artyom Abakumov
committed
Merge remote-tracking branch 'origin/master' into windows_C4554_C4018_warnings
2 parents 5b1fbdd + 1251401 commit d4fc7eb

32 files changed

+70
-92
lines changed

builds/posix/make.defaults

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ GLOB_OPTIONS:=
111111
#____________________________________________________________________________
112112

113113
# Global c++ flags: firebird needs no RTTI, choose build standard and c++ specific warnings level
114-
PLUSPLUS_FLAGS:= -fno-rtti -std=c++17 -Werror=delete-incomplete
114+
PLUSPLUS_FLAGS:= -fno-rtti -std=c++17 -Werror=delete-incomplete -Werror=return-type
115115

116116
# If this is defined then we use special rules useful for developers only
117117
IsDeveloper = @DEVEL_FLG@

builds/win32/msvc15/FirebirdCommon.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
<UseFullPaths>false</UseFullPaths>
2929
<MultiProcessorCompilation>true</MultiProcessorCompilation>
3030
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
31+
<TreatSpecificWarningsAsErrors>4715</TreatSpecificWarningsAsErrors>
3132
</ClCompile>
3233
<Link>
3334
<SuppressStartupBanner>true</SuppressStartupBanner>

src/common/CvtFormat.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ namespace
7070
}
7171
}
7272

73-
bool contains(const char* value, USHORT& outTimezoneId, FB_SIZE_T& outParsedTimezoneLength)
73+
bool contains(const char* value, USHORT& outTimezoneId, unsigned int& outParsedTimezoneLength)
7474
{
7575
const TrieNode* currentNode = m_root;
7676
FB_SIZE_T valueLength = fb_strlen(value);
@@ -97,7 +97,7 @@ namespace
9797
TrieNode* currentNode = m_root;
9898
FB_SIZE_T valueLength = fb_strlen(value);
9999

100-
for (FB_SIZE_T i = 0; i < valueLength; i++)
100+
for (unsigned int i = 0; i < valueLength; i++)
101101
{
102102
int index = calculateIndex(value[i]);
103103

@@ -460,7 +460,7 @@ namespace
460460
patternStr = std::string_view(format + formatStart, offset - formatStart + 1);
461461
bool isFound = false;
462462

463-
for (int j = 0; j < PatternsSize; j++)
463+
for (unsigned int j = 0; j < PatternsSize; j++)
464464
{
465465
if (!strncmp(patterns[j], patternStr.data(), patternStr.length()))
466466
{
@@ -1124,6 +1124,7 @@ namespace
11241124
return twelveHours == 12 ? twelveHours : 12 + twelveHours;
11251125

11261126
cb->err(Arg::Gds(isc_incorrect_hours_period) << string(period.data(), period.length()));
1127+
return 0; // suppress compiler warning/error
11271128
}
11281129

11291130
constexpr int roundYearPatternImplementation(int parsedRRValue, int currentYear)
@@ -1331,7 +1332,7 @@ namespace
13311332
bool isFound = false;
13321333

13331334
std::string_view monthShortName = getSubstringFromString(str, strLength, strOffset, 3);
1334-
for (int i = 0; i < FB_NELEM(FB_SHORT_MONTHS) - 1; i++)
1335+
for (FB_SIZE_T i = 0; i < FB_NELEM(FB_SHORT_MONTHS) - 1; i++)
13351336
{
13361337
if (std::equal(monthShortName.begin(), monthShortName.end(),
13371338
FB_SHORT_MONTHS[i], FB_SHORT_MONTHS[i] + strlen(FB_SHORT_MONTHS[i]),
@@ -1352,7 +1353,7 @@ namespace
13521353
bool isFound = false;
13531354

13541355
std::string_view monthFullName = getSubstringFromString(str, strLength, strOffset);
1355-
for (int i = 0; i < FB_NELEM(FB_LONG_MONTHS_UPPER) - 1; i++)
1356+
for (FB_SIZE_T i = 0; i < FB_NELEM(FB_LONG_MONTHS_UPPER) - 1; i++)
13561357
{
13571358
if (std::equal(monthFullName.begin(), monthFullName.end(),
13581359
FB_LONG_MONTHS_UPPER[i], FB_LONG_MONTHS_UPPER[i] + strlen(FB_LONG_MONTHS_UPPER[i]),
@@ -1541,7 +1542,7 @@ namespace
15411542
}
15421543
case Format::TZR:
15431544
{
1544-
FB_SIZE_T parsedTimezoneNameLength = 0;
1545+
unsigned int parsedTimezoneNameLength = 0;
15451546
const bool timezoneNameIsCorrect = timeZoneTrie().contains(str + strOffset, outTimezoneId, parsedTimezoneNameLength);
15461547
if (!timezoneNameIsCorrect)
15471548
status_exception::raise(Arg::Gds(isc_invalid_timezone_region) << string(str + strOffset, parsedTimezoneNameLength));
@@ -1668,7 +1669,7 @@ ISC_TIMESTAMP_TZ CVT_format_string_to_datetime(const dsc* desc, const Firebird::
16681669
stringUpper[i] = toupper(sourceString[i]);
16691670

16701671
string formatUpper(format.length(), '\0');
1671-
for (auto i = 0; i < format.length(); i++)
1672+
for (unsigned int i = 0; i < format.length(); i++)
16721673
formatUpper[i] = toupper(format[i]);
16731674

16741675
StringToDateTimeData cvtData;

src/common/SimilarToRegex.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ namespace
410410
if (!hasPatternChar() || getPatternChar() != ']')
411411
status_exception::raise(Arg::Gds(isc_invalid_similar_pattern));
412412

413-
for (item.clazz = 0; item.clazz < FB_NELEM(classes); ++item.clazz)
413+
for (item.clazz = 0; static_cast<FB_SIZE_T>(item.clazz) < FB_NELEM(classes); ++item.clazz)
414414
{
415415
if (fb_utils::strnicmp(patternStr + charSavePos,
416416
classes[item.clazz].similarClass, len) == 0)
@@ -419,7 +419,7 @@ namespace
419419
}
420420
}
421421

422-
if (item.clazz >= FB_NELEM(classes))
422+
if (static_cast<FB_SIZE_T>(item.clazz) >= FB_NELEM(classes))
423423
status_exception::raise(Arg::Gds(isc_invalid_similar_pattern));
424424
}
425425
else

src/common/TextType.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ TextType::TextType(TTYPE_ID _type, texttype *_tt, USHORT _attributes, CharSet* _
153153
{'S', CHAR_UPPER_S}
154154
};
155155

156-
for (int i = 0; i < FB_NELEM(conversions); i++)
156+
for (FB_SIZE_T i = 0; i < FB_NELEM(conversions); i++)
157157
{
158158
try
159159
{

src/common/call_service.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ void callRemoteServiceManager(ISC_STATUS* status,
465465
{
466466
const char request[] = {isc_info_svc_get_users};
467467
int startQuery = 0;
468-
Auth::StackUserData uData;
468+
Auth::UserData uData;
469469

470470
for (;;)
471471
{

src/common/classes/NoThrowTimeStamp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ void NoThrowTimeStamp::round_time(ISC_TIME &ntime, const int precision)
330330
if (scale <= 0)
331331
return;
332332

333-
fb_assert(scale < FB_NELEM(POW_10_TABLE));
333+
fb_assert(static_cast<FB_SIZE_T>(scale) < FB_NELEM(POW_10_TABLE));
334334

335335
const ISC_TIME period = POW_10_TABLE[scale];
336336

src/common/dsc.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,7 +1356,7 @@ static bool validate_dsc_tables();
13561356

13571357

13581358

1359-
int dsc::getStringLength() const
1359+
USHORT dsc::getStringLength() const
13601360
{
13611361
return DSC_string_length(this);
13621362
}
@@ -1533,7 +1533,7 @@ bool DSC_make_descriptor(DSC* desc,
15331533
}
15341534

15351535

1536-
int DSC_string_length(const dsc* desc)
1536+
USHORT DSC_string_length(const dsc* desc)
15371537
{
15381538
/**************************************
15391539
*
@@ -1561,10 +1561,10 @@ int DSC_string_length(const dsc* desc)
15611561
return desc->dsc_length - sizeof(USHORT);
15621562
default:
15631563
if (!DTYPE_IS_EXACT(desc->dsc_dtype) || desc->dsc_scale == 0)
1564-
return (int) _DSC_convert_to_text_length[desc->dsc_dtype];
1564+
return _DSC_convert_to_text_length[desc->dsc_dtype];
15651565
if (desc->dsc_scale < 0)
1566-
return (int) _DSC_convert_to_text_length[desc->dsc_dtype] + 1;
1567-
return (int) _DSC_convert_to_text_length[desc->dsc_dtype] + desc->dsc_scale;
1566+
return _DSC_convert_to_text_length[desc->dsc_dtype] + 1;
1567+
return _DSC_convert_to_text_length[desc->dsc_dtype] + desc->dsc_scale;
15681568
}
15691569
}
15701570

src/common/dsc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ typedef struct dsc
499499
dsc_address = address;
500500
}
501501

502-
int getStringLength() const;
502+
USHORT getStringLength() const;
503503

504504
operator Ods::Descriptor() const
505505
{

src/common/dsc_proto.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#include "../common/dsc.h"
2828

29-
int DSC_string_length(const struct dsc*);
29+
USHORT DSC_string_length(const struct dsc*);
3030
const TEXT* DSC_dtype_tostring(UCHAR);
3131
void DSC_get_dtype_name(const dsc*, TEXT*, USHORT);
3232
bool DSC_make_descriptor(dsc*, USHORT, SSHORT,

0 commit comments

Comments
 (0)