Skip to content

Commit 566bebf

Browse files
authored
Make return-type a compilation error (#8362)
This protects from undefined behavior cases that can be added to the code by mistake.
1 parent fa83e79 commit 566bebf

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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)

0 commit comments

Comments
 (0)