Skip to content

Commit

Permalink
Add license and C23 C++23
Browse files Browse the repository at this point in the history
  • Loading branch information
flagarde committed May 8, 2024
1 parent 191b861 commit 2d3edf6
Show file tree
Hide file tree
Showing 17 changed files with 146 additions and 8 deletions.
6 changes: 6 additions & 0 deletions .LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Khaos
C/C++ library for writing cross-platform codes.

SPDX-FileCopyrightText: 2019-2024 flagarde

SPDX-License-Identifier: MIT
3 changes: 3 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ repos:
- id: remove-tabs
name: tabs remover
args: [--whitespaces-count, '2']
- id: insert-license
files: \.(h(pp)|h(pp.in)|c(pp)|h.in|c?)$
args: [--license-filepath, .LICENSE, --comment-style, /*|*|*/, --use-current-year, --fuzzy-match-generates-todo, --fuzzy-ratio-cut-off, '85', --fuzzy-match-todo-instructions, ' TODO: Delete the inconsistent license and above line and rerun pre-commit to insert a good license. If this is the desired behavior add "// insert-license=off" at the beginning to the file.', --skip-license-insertion-comment, '// insert-license=off' ]

- repo: https://github.com/codespell-project/codespell
rev: v2.2.2
Expand Down
10 changes: 9 additions & 1 deletion include/khaos/C.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
/*
* Khaos
* C/C++ library for writing cross-platform codes.
*
* SPDX-FileCopyrightText: 2020-2024 flagarde
*
* SPDX-License-Identifier: MIT
*/

#ifndef KHAOS_C_H_
#define KHAOS_C_H_

/** \file C.h
* \copyright 2022 flagarde
* \brief Detect the C standard and define some useful macros.
*/

Expand Down
11 changes: 10 additions & 1 deletion include/khaos/CStandards.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
/*
* Khaos
* C/C++ library for writing cross-platform codes.
*
* SPDX-FileCopyrightText: 2020-2024 flagarde
*
* SPDX-License-Identifier: MIT
*/

#ifndef KHAOS_CSTANDARDS_H_
#define KHAOS_CSTANDARDS_H_

/*! \file CStandards.h
* \copyright 2022 flagarde
* \brief Define the values of the official C standard.
* Define macros that expand to the integer constant of type \b long whose value are the version of the C standard.
* Official values for the \b __STDC_VERSION__ macro.
Expand All @@ -13,5 +21,6 @@
#define KHAOS_STANDARD_C99_PRIVATE() (199901L) /*!< Value for the C99 standard */
#define KHAOS_STANDARD_C11_PRIVATE() (201112L) /*!< Value for the C11 standard */
#define KHAOS_STANDARD_C17_PRIVATE() (201710L) /*!< Value for the C17 standard */
#define KHAOS_STANDARD_C23_PRIVATE() (202311L) /*!< Value for the C23 standard */

#endif /* KHAOS_CSTANDARDS_H_ */
10 changes: 9 additions & 1 deletion include/khaos/CXX.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
/*
* Khaos
* C/C++ library for writing cross-platform codes.
*
* SPDX-FileCopyrightText: 2020-2024 flagarde
*
* SPDX-License-Identifier: MIT
*/

#ifndef KHAOS_CXX_H_
#define KHAOS_CXX_H_

/*! \file CXX.h
* \copyright 2022 flagarde
* \brief Detect the C++ standard and define some useful macros.
* \warning \b CXX11 is always false for \b MSVC only c++14 and upper are considered.
*/
Expand Down
11 changes: 10 additions & 1 deletion include/khaos/CXXStandards.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
/*
* Khaos
* C/C++ library for writing cross-platform codes.
*
* SPDX-FileCopyrightText: 2020-2024 flagarde
*
* SPDX-License-Identifier: MIT
*/

#ifndef KHAOS_CXXSTANDARDS_H_
#define KHAOS_CXXSTANDARDS_H_

/*! \file CXXStandards.h
* \copyright 2022 flagarde
* \brief Define the version of the C++ standard.
* Define macros that expand to the integer constant of type \b long whose value are the version of the C++ standard.
* Official values for the \b __cplusplus macro.
Expand All @@ -13,5 +21,6 @@
#define KHAOS_STANDARD_CXX14_PRIVATE() (201402L) /*!< Value for the C++14 standard */
#define KHAOS_STANDARD_CXX17_PRIVATE() (201703L) /*!< Value for the C++17 standard */
#define KHAOS_STANDARD_CXX20_PRIVATE() (202002L) /*!< Value for the C++20 standard */
#define KHAOS_STANDARD_CXX23_PRIVATE() (202302L) /*!< Value for the C++23 standard */

#endif /* KHAOS_CXXSTANDARDS_H_ */
10 changes: 9 additions & 1 deletion include/khaos/CompareVersionMacros.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
/*
* Khaos
* C/C++ library for writing cross-platform codes.
*
* SPDX-FileCopyrightText: 2020-2024 flagarde
*
* SPDX-License-Identifier: MIT
*/

#ifndef KHAOS_COMPAREVERSIONMACROS_H_
#define KHAOS_COMPAREVERSIONMACROS_H_

#include "khaos/KhaosVersion.h"
#include "khaos/VersionMacros.h"

/** \file CompareVersionMacros.h
* \copyright 2022 flagarde
* \brief Define macros to compare versions.
* \note Use these macros only if you need preprocessor version checking.
* \note For example :
Expand Down
10 changes: 9 additions & 1 deletion include/khaos/KhaosVersion.h.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
/*
* Khaos
* C/C++ library for writing cross-platform codes.
*
* SPDX-FileCopyrightText: 2020-2024 flagarde
*
* SPDX-License-Identifier: MIT
*/

/** \file KhaosVersion.h
* \copyright 2022 flagarde
*
* \brief Macros providing the Khaos version.
*
Expand Down
10 changes: 9 additions & 1 deletion include/khaos/Language.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
/*
* Khaos
* C/C++ library for writing cross-platform codes.
*
* SPDX-FileCopyrightText: 2020-2024 flagarde
*
* SPDX-License-Identifier: MIT
*/

#ifndef KHAOS_LANGUAGE_H_
#define KHAOS_LANGUAGE_H_

/*! \file Languages.h
* \copyright 2022 flagarde
* \brief Detect the languages and define some useful macros.
*/

Expand Down
10 changes: 9 additions & 1 deletion include/khaos/VersionMacros.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
/*
* Khaos
* C/C++ library for writing cross-platform codes.
*
* SPDX-FileCopyrightText: 2020-2024 flagarde
*
* SPDX-License-Identifier: MIT
*/

#ifndef KHAOS_VERSIONMACROS_H_
#define KHAOS_VERSIONMACROS_H_

/** \file VersionMacros.h
* \copyright 2022 flagarde
* \brief Define macros to set, get versions.
* \note Use these macros only if you need preprocessor version checking.
* \note For example :
Expand Down
9 changes: 9 additions & 0 deletions tests/CStandards.test.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
* Khaos
* C/C++ library for writing cross-platform codes.
*
* SPDX-FileCopyrightText: 2020-2024 flagarde
*
* SPDX-License-Identifier: MIT
*/

/* Copyright 2022 flagarde */

#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
Expand Down
9 changes: 9 additions & 0 deletions tests/CXXStandards.test.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
* Khaos
* C/C++ library for writing cross-platform codes.
*
* SPDX-FileCopyrightText: 2020-2024 flagarde
*
* SPDX-License-Identifier: MIT
*/

/* Copyright 2022 flagarde */

#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
Expand Down
9 changes: 9 additions & 0 deletions tests/CompareVersionMacros.test.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
* Khaos
* C/C++ library for writing cross-platform codes.
*
* SPDX-FileCopyrightText: 2020-2024 flagarde
*
* SPDX-License-Identifier: MIT
*/

/* Copyright 2022 flagarde */

#include "khaos/CompareVersionMacros.h"
Expand Down
9 changes: 9 additions & 0 deletions tests/KhaosVersion.test.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
* Khaos
* C/C++ library for writing cross-platform codes.
*
* SPDX-FileCopyrightText: 2020-2024 flagarde
*
* SPDX-License-Identifier: MIT
*/

/* Copyright 2022 flagarde */
#include "khaos/KhaosVersion.h"

Expand Down
9 changes: 9 additions & 0 deletions tests/LanguageC.test.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
* Khaos
* C/C++ library for writing cross-platform codes.
*
* SPDX-FileCopyrightText: 2024-2024 flagarde
*
* SPDX-License-Identifier: MIT
*/

/* Copyright 2022 flagarde */

#include "khaos/Language.h"
Expand Down
9 changes: 9 additions & 0 deletions tests/LanguageCXX.test.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
* Khaos
* C/C++ library for writing cross-platform codes.
*
* SPDX-FileCopyrightText: 2020-2024 flagarde
*
* SPDX-License-Identifier: MIT
*/

/* Copyright 2022 flagarde */
/* doctest need c++11 so disable it to test C++98 */

Expand Down
9 changes: 9 additions & 0 deletions tests/VersionMacros.test.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
* Khaos
* C/C++ library for writing cross-platform codes.
*
* SPDX-FileCopyrightText: 2020-2024 flagarde
*
* SPDX-License-Identifier: MIT
*/

/* Copyright 2022 flagarde */

#include "khaos/VersionMacros.h"
Expand Down

0 comments on commit 2d3edf6

Please sign in to comment.