mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 12:03:03 +01:00
Update allowed C++ version (#7654)
* Update allowed C++ version. * Build examples using C++11. * Remove pre-C++11 fallback in examples code - thanks to Alex.
This commit is contained in:
parent
a54a3079d9
commit
93acbd1aef
@ -1,11 +1,12 @@
|
||||
# Modern C++ features
|
||||
|
||||
We define here as "modern C++" features the ones introduced since C++17. These features should be used in a "controlled" form in Firebird code, as not all compilers fully support them.
|
||||
It's allowed to use in Firebird internal code C++ features up to and including C++17.
|
||||
|
||||
Only ones mentioned in this document could be used, but as necessities appears, discussion should be started in the devel list or pull requests.
|
||||
Public files (as API headers) is limited to C++11.
|
||||
|
||||
Exceptions to these rules should be listed below and must be agreed by the team,
|
||||
discussing in the devel list or by pull request.
|
||||
|
||||
## Allowed features
|
||||
|
||||
### C++17
|
||||
|
||||
- [if with init-statement](https://en.cppreference.com/w/cpp/language/if)
|
||||
### C++20
|
||||
|
@ -1604,7 +1604,7 @@ ISomePlugin implementation</i></font></p>
|
||||
<p style="margin-bottom: 0cm"><font size="4" style="font-size: 14pt"><i>private:</i></font></p>
|
||||
<p style="margin-bottom: 0cm"><font size="4" style="font-size: 14pt"><i>IPluginConfig*
|
||||
config;</i></font></p>
|
||||
<p style="margin-bottom: 0cm"><font size="4" style="font-size: 14pt"><i>FbSampleAtomic
|
||||
<p style="margin-bottom: 0cm"><font size="4" style="font-size: 14pt"><i>std::atomic_int
|
||||
refCounter;</i></font></p>
|
||||
<p style="margin-bottom: 0cm"><font size="4" style="font-size: 14pt"><i>IReferenceCounted*
|
||||
owner;</i></font></p>
|
||||
@ -2777,7 +2777,7 @@ interface – replaces (partially) isc_stmt_handle.</font></p>
|
||||
behavior.</font></p>
|
||||
<li><p style="margin-bottom: 0cm"><font size="4" style="font-size: 14pt">void
|
||||
setCursorName(StatusType* status, const char* name) – replaces
|
||||
isc_dsql_set_cursor_name().</font>
|
||||
isc_dsql_set_cursor_name().</font>
|
||||
</p>
|
||||
<li><p style="margin-bottom: 0cm"><font size="4" style="font-size: 14pt">void
|
||||
free(StatusType* status) – free statement, releases interface on
|
||||
@ -3817,4 +3817,4 @@ release of it.</font></p>
|
||||
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
@ -25,6 +25,7 @@
|
||||
*/
|
||||
|
||||
#include "../interfaces/ifaceExamples.h"
|
||||
#include <atomic>
|
||||
|
||||
namespace
|
||||
{
|
||||
@ -189,7 +190,7 @@ private:
|
||||
IPluginConfig* config;
|
||||
ISC_UCHAR key;
|
||||
|
||||
FbSampleAtomic refCounter;
|
||||
std::atomic_int refCounter;
|
||||
IReferenceCounted* owner;
|
||||
|
||||
IConfigEntry* getEntry(CheckStatusWrapper* status, const char* entryName);
|
||||
|
@ -25,6 +25,7 @@
|
||||
*/
|
||||
|
||||
#include "../interfaces/ifaceExamples.h"
|
||||
#include <atomic>
|
||||
|
||||
using namespace Firebird;
|
||||
|
||||
@ -121,7 +122,7 @@ private:
|
||||
char savedKeyName[32];
|
||||
ISC_UCHAR key;
|
||||
|
||||
FbSampleAtomic refCounter;
|
||||
std::atomic_int refCounter;
|
||||
IReferenceCounted* owner;
|
||||
|
||||
void noKeyError(CheckStatusWrapper* status);
|
||||
|
@ -61,7 +61,7 @@ KEYGEN_objects=$(INTERMED)/keygen.o
|
||||
TCWRAP_objects=$(INTERMED)/TcWrapper.o
|
||||
KEY_AUTH_objects=$(INTERMED)/ExtAuth.o
|
||||
|
||||
CXXFLAGS=-std=c++17 -pthread -I$(ROOT)/include -fPIC $(TOMCRYPT_COMPILE)
|
||||
CXXFLAGS=-std=c++11 -pthread -I$(ROOT)/include -fPIC $(TOMCRYPT_COMPILE)
|
||||
LDFLAGS=-pthread -L$(LIB) -Wl,-rpath,'$$ORIGIN/../lib' $(TOMCRYPT_LINK)
|
||||
|
||||
LINK_LIBS=-lfbclient -ltomcrypt -ltommath
|
||||
|
@ -31,6 +31,7 @@
|
||||
*/
|
||||
|
||||
#include "ifaceExamples.h"
|
||||
#include <atomic>
|
||||
|
||||
static IMaster* master = fb_get_master_interface();
|
||||
|
||||
@ -66,7 +67,7 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
FbSampleAtomic referenceCounter;
|
||||
std::atomic_int referenceCounter;
|
||||
|
||||
// we are using only single field (varchar) in a sample, therefore no strong alignment requirements.
|
||||
// In general message alignment is the maximum field alignment in that message.
|
||||
|
@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
#include "ifaceExamples.h"
|
||||
#include <atomic>
|
||||
|
||||
#ifndef WIN32
|
||||
#include <unistd.h>
|
||||
@ -115,7 +116,7 @@ namespace
|
||||
status.dispose();
|
||||
}
|
||||
|
||||
FbSampleAtomic refCounter;
|
||||
std::atomic_int refCounter;
|
||||
IAttachment* attachment;
|
||||
volatile int counter;
|
||||
ThrowStatusWrapper status;
|
||||
|
@ -28,13 +28,6 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(__cplusplus) && (__cplusplus >= 201103L)
|
||||
#include <atomic>
|
||||
typedef std::atomic_int FbSampleAtomic;
|
||||
#else
|
||||
typedef int FbSampleAtomic;
|
||||
#endif
|
||||
|
||||
#include <firebird/Interface.h>
|
||||
|
||||
using namespace Firebird;
|
||||
|
@ -33,7 +33,7 @@ FBCLIENT = $(FIREBIRD)/lib/libfbclient.so
|
||||
# General Compiler and linker Defines for Linux
|
||||
# ---------------------------------------------------------------------
|
||||
CXX = c++
|
||||
CXXFLAGS= -c -Wall -g3 -std=c++17 -fno-rtti $(INCLUDE)
|
||||
CXXFLAGS= -c -Wall -g3 -std=c++11 -fno-rtti $(INCLUDE)
|
||||
RM = rm -f
|
||||
|
||||
#
|
||||
|
@ -173,9 +173,6 @@ Program Description
|
||||
12.batch_isc.cpp Working with batch interface from ISC API.
|
||||
|
||||
|
||||
FbSampleAtomic typedef required in many examples.
|
||||
|
||||
|
||||
|
||||
dbcrypt - a sample of XOR database encryption (do not use in production!!!)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user