From f2678b0545a715d106ad92fdbc9b931e1a27bfd3 Mon Sep 17 00:00:00 2001 From: Daniel Bahr Date: Fri, 20 Jun 2025 20:54:14 -0700 Subject: [PATCH] Set CRCPP_USE_CPP11 automatically with conforming C++11 compilers. Update version to 1.2.1.0 and update copyright. --- README.md | 2 +- inc/CRC.h | 16 ++++++++++------ test/prj/gcc/Makefile | 2 +- test/src/main.cpp | 4 ++-- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 0e3be14..68d9526 100644 --- a/README.md +++ b/README.md @@ -162,7 +162,7 @@ Define to place all CRC++ code within the ::CRCPP namespace. Not defined by defa * `#define CRCPP_BRANCHLESS`
Define to enable a branchless CRC implementation. The branchless implementation uses a single integer multiplication in the bit-by-bit calculation instead of a small conditional. The branchless implementation may be faster on processor architectures which support single-instruction integer multiplication. Not defined by default. * `#define CRCPP_USE_CPP11` -Define to enables C++11 features (move semantics, constexpr, static_assert, etc.). Not defined by default. +Define to enables C++11 features (move semantics, constexpr, static_assert, etc.). Enabled by default when a C++11 compiler is detected (`__cplusplus >= 201103L`). * `#define CRCPP_INCLUDE_ESOTERIC_CRC_DEFINITIONS` Define to include definitions for little-used CRCs. Not defined by default. diff --git a/inc/CRC.h b/inc/CRC.h index aef563b..e040159 100644 --- a/inc/CRC.h +++ b/inc/CRC.h @@ -1,11 +1,11 @@ /** @file CRC.h @author Daniel Bahr - @version 1.2.0.0 + @version 1.2.1.0 @copyright @parblock CRC++ - Copyright (c) 2022, Daniel Bahr + Copyright (c) 2022-2025, Daniel Bahr All rights reserved. Redistribution and use in source and binary forms, with or without @@ -58,6 +58,10 @@ #ifndef CRCPP_CRC_H_ #define CRCPP_CRC_H_ +#if __cplusplus >= 201103L && !defined(CRCPP_USE_CPP11) +#define CRCPP_USE_CPP11 +#endif + #include // Includes CHAR_BIT #ifdef CRCPP_USE_CPP11 #include // Includes ::std::size_t @@ -141,15 +145,15 @@ namespace CRCPP #ifdef CRCPP_USE_CPP11 crcpp_constexpr int CRCPP_MAJOR_VERSION = 1; crcpp_constexpr int CRCPP_MINOR_VERSION = 2; -crcpp_constexpr int CRCPP_PATCH_VERSION = 0; +crcpp_constexpr int CRCPP_PATCH_VERSION = 1; crcpp_constexpr int CRCPP_REVISION_VERSION = 0; -crcpp_constexpr char CRCPP_COPYRIGHT[] = "Copyright (c) 2022, Daniel Bahr"; +crcpp_constexpr char CRCPP_COPYRIGHT[] = "Copyright (c) 2022-2025, Daniel Bahr"; #else #define CRCPP_MAJOR_VERSION 1 #define CRCPP_MINOR_VERSION 2 -#define CRCPP_PATCH_VERSION 0 +#define CRCPP_PATCH_VERSION 1 #define CRCPP_REVISION_VERSION 0 -#define CRCPP_COPYRIGHT "Copyright (c) 2022, Daniel Bahr" +#define CRCPP_COPYRIGHT "Copyright (c) 2022-2025, Daniel Bahr" #endif /** diff --git a/test/prj/gcc/Makefile b/test/prj/gcc/Makefile index 9223817..63ad98e 100644 --- a/test/prj/gcc/Makefile +++ b/test/prj/gcc/Makefile @@ -18,7 +18,7 @@ $(TARGET): $(OBJ_FILES) $(MKDIR) -p $(BINDIR) $(LINKER) $(LDFLAGS) -o $@ $^ -$(OUTDIR)/%.o: $(SRCDIR)/%.cpp +$(OUTDIR)/%.o: $(SRCDIR)/%.cpp $(INCDIR)/CRC.h $(CXX) $(CXXFLAGS) -c -o $@ $< $(OUTDIR): diff --git a/test/src/main.cpp b/test/src/main.cpp index 52cdf5a..b7ee9be 100644 --- a/test/src/main.cpp +++ b/test/src/main.cpp @@ -1,11 +1,11 @@ /** @file main.cpp @author Daniel Bahr - @version 1.2.0.0 + @version 1.2.1.0 @copyright @parblock CRC++ - Copyright (c) 2022, Daniel Bahr + Copyright (c) 2022-2025, Daniel Bahr All rights reserved. Redistribution and use in source and binary forms, with or without