From 44088ceecc538ebfae30d6a7ba929decd44a02dc Mon Sep 17 00:00:00 2001 From: lexouduck Date: Thu, 14 Mar 2024 17:17:58 +0900 Subject: [PATCH 1/8] refactor,feature(libccc/sys/ansi.h): renamed all the IO_* macros to ANSI_*, and added several new ones to control the commandline cursor and to erase parts of the commandline --- VERSION | 2 +- hdr/libccc/sys/ansi.h | 164 ++++++++++++++++++-------------- src/sys/logger/core.c | 2 +- src/sys/logger/log.c | 36 +++---- src/sys/logger/util.c | 6 +- src/sys/time/parse.c | 2 +- test/libccc/math/math.c | 14 +-- test/libccc/random/random.c | 2 +- test/libccc/text/char_ascii.c | 8 +- test/libccc/text/char_unicode.c | 8 +- test/standalone/kvt.c | 6 +- test/test.c | 32 +++---- test/test_timer.c | 4 +- test/test_utils.h | 14 +-- test/util_print.c | 40 ++++---- 15 files changed, 182 insertions(+), 158 deletions(-) diff --git a/VERSION b/VERSION index 97008aa2..5fe12cc6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -libccc@0.11.32-2023-04-07_f1d7e1536c378a835b828e5a441421edb3859cc7 +libccc@0.11.33-2024-03-14_d971ce0827c8cad9659b12d18a65c935dbc1f18c diff --git a/hdr/libccc/sys/ansi.h b/hdr/libccc/sys/ansi.h index 676d776b..c1d11a9b 100644 --- a/hdr/libccc/sys/ansi.h +++ b/hdr/libccc/sys/ansi.h @@ -35,6 +35,32 @@ HEADER_CPP ** ************************************************************************** *| */ +#define ANSI_ESC(SEQUENCE, NUMBER) "\x1B["#NUMBER""SEQUENCE"" //!< A helper macro used to construct common ANSI commandline escape codes. + +// ANSI cursor functions + +#define ANSI_CURSOR_SAVE() "\x1B 7" //!< A special ANSI escape code to save the current position of the cursor (DEC). +#define ANSI_CURSOR_LOAD() "\x1B 8" //!< A special ANSI escape code to restore the cursor to its last saved position (DEC). +#define ANSI_CURSOR_MOVE(LINE, COLUMN) "\x1B["#LINE";"#COLUMN"H" //!< A special ANSI escape code to move the cursor to the specified position. +#define ANSI_CURSOR_MOVE_UP(LINES) ANSI_ESC('A', LINES) //!< A special ANSI escape code to move the cursor up # lines. +#define ANSI_CURSOR_MOVE_DOWN(LINES) ANSI_ESC('B', LINES) //!< A special ANSI escape code to move the cursor down # lines. +#define ANSI_CURSOR_MOVE_RIGHT(LINES) ANSI_ESC('C', LINES) //!< A special ANSI escape code to move the cursor right # columns. +#define ANSI_CURSOR_MOVE_LEFT(LINES) ANSI_ESC('D', LINES) //!< A special ANSI escape code to move the cursor left # columns. +#define ANSI_CURSOR_NEXTLINE(LINES) ANSI_ESC('E', LINES) //!< A special ANSI escape code to put the cursor at the beginning of the next line, # lines down. +#define ANSI_CURSOR_PREVLINE(LINES) ANSI_ESC('F', LINES) //!< A special ANSI escape code to put the cursor at the beginning of the previous line, # lines up. + +// ANSI erase functions + +#define ANSI_ERASE_SCREEN_AFTER ANSI_ESC('J', 0) //!< A special ANSI escape code to erase from cursor until end of screen. +#define ANSI_ERASE_SCREEN_BEFORE ANSI_ESC('J', 1) //!< A special ANSI escape code to erase from cursor to beginning of screen. +#define ANSI_ERASE_SCREEN ANSI_ESC('J', 2) //!< A special ANSI escape code to erase the entire screen. +#define ANSI_ERASE_SAVED ANSI_ESC('J', 3) //!< A special ANSI escape code to erase all saved lines. +#define ANSI_ERASE_LINE_AFTER ANSI_ESC('K', 0) //!< A special ANSI escape code to erase from cursor to end of line. +#define ANSI_ERASE_LINE_BEFORE ANSI_ESC('K', 1) //!< A special ANSI escape code to erase start of line to the cursor. +#define ANSI_ERASE_LINE ANSI_ESC('K', 2) //!< A special ANSI escape code to erase the entire line. + +// ANSI color & style functions + //! ANSI text output display escape code macros /*! ** These are some useful string literals for commandline output colors. @@ -43,48 +69,29 @@ HEADER_CPP ** (Learn more here)[https://misc.flogisoft.com/bash/tip_colors_and_formatting] */ //! @{ -#define ANSI(X) "\x1B["X"m" - -// TODO refactor these macros to instead have an 'ANSI_' prefix - -#define IO_RESET ANSI("0") //!< The string sequence to reset the terminal text output to its default color - -#define IO_TEXT_BOLD ANSI("1") //!< Display terminal output text in bold -#define IO_TEXT_DIM ANSI("2") //!< Display terminal output text with dimmer, darker colors -#define IO_TEXT_3 ANSI("3") //!< ??? -#define IO_TEXT_UNDERLINE ANSI("4") //!< Display terminal output text with an underline -#define IO_TEXT_BLINK ANSI("5") //!< Display terminal output text which blinks every second (only in tty and xterm) -#define IO_TEXT_6 ANSI("6") //!< ??? -#define IO_TEXT_INVERTED ANSI("7") //!< Display terminal output text with the background/foreground colors reversed -#define IO_TEXT_HIDDEN ANSI("8") //!< Write, but do not display, the terminal output text (useful for passwords) -#define IO_TEXT_9 ANSI("9") //!< ??? - -#define IO_TEXT_RESET_BOLD ANSI("21") //!< Undoes the effects of #IO_TEXT_BOLD -#define IO_TEXT_RESET_DIM ANSI("22") //!< Undoes the effects of #IO_TEXT_DIM -#define IO_TEXT_RESET_3 ANSI("23") //!< Undoes the effects of #IO_TEXT_3 -#define IO_TEXT_RESET_UNDERLINE ANSI("24") //!< Undoes the effects of #IO_TEXT_UNDERLINE -#define IO_TEXT_RESET_BLINK ANSI("25") //!< Undoes the effects of #IO_TEXT_BLINK -#define IO_TEXT_RESET_6 ANSI("26") //!< Undoes the effects of #IO_TEXT_6 -#define IO_TEXT_RESET_INVERTED ANSI("27") //!< Undoes the effects of #IO_TEXT_INVERTED -#define IO_TEXT_RESET_HIDDEN ANSI("28") //!< Undoes the effects of #IO_TEXT_HIDDEN -#define IO_TEXT_RESET_9 ANSI("29") //!< Undoes the effects of #IO_TEXT_9 - -#define IO_COLOR_FG_BLACK ANSI("30") //!< The string sequence to color the terminal text output black -#define IO_COLOR_FG_RED ANSI("31") //!< The string sequence to color the terminal text output red -#define IO_COLOR_FG_GREEN ANSI("32") //!< The string sequence to color the terminal text output green -#define IO_COLOR_FG_YELLOW ANSI("33") //!< The string sequence to color the terminal text output yellow -#define IO_COLOR_FG_BLUE ANSI("34") //!< The string sequence to color the terminal text output blue -#define IO_COLOR_FG_MAGENTA ANSI("35") //!< The string sequence to color the terminal text output magenta -#define IO_COLOR_FG_CYAN ANSI("36") //!< The string sequence to color the terminal text output cyan -#define IO_COLOR_FG_GRAY_LIGHT ANSI("37") //!< The string sequence to color the terminal text output light gray -#define IO_COLOR_FG_GRAY_DARK ANSI("90") //!< The string sequence to color the terminal text output dark gray -#define IO_COLOR_FG_RED_LIGHT ANSI("91") //!< The string sequence to color the terminal text output light red -#define IO_COLOR_FG_GREEN_LIGHT ANSI("92") //!< The string sequence to color the terminal text output light green -#define IO_COLOR_FG_YELLOW_LIGHT ANSI("93") //!< The string sequence to color the terminal text output light yellow -#define IO_COLOR_FG_BLUE_LIGHT ANSI("94") //!< The string sequence to color the terminal text output light blue -#define IO_COLOR_FG_MAGENTA_LIGHT ANSI("95") //!< The string sequence to color the terminal text output light magenta -#define IO_COLOR_FG_CYAN_LIGHT ANSI("96") //!< The string sequence to color the terminal text output light cyan -#define IO_COLOR_FG_WHITE ANSI("97") //!< The string sequence to color the terminal text output white +#define ANSI_STYLE(CODE) "\x1B["#CODE"m" + +#define ANSI_RESET ANSI_STYLE(0) //!< The string sequence to reset the terminal text output to its default color + +#define ANSI_STYLE_BOLD ANSI_STYLE(1) //!< Display terminal output text in bold +#define ANSI_STYLE_DIM ANSI_STYLE(2) //!< Display terminal output text with dimmer, darker colors +#define ANSI_STYLE_ITALIC ANSI_STYLE(3) //!< Display terminal output text in italic +#define ANSI_STYLE_UNDERLINE ANSI_STYLE(4) //!< Display terminal output text with an underline +#define ANSI_STYLE_BLINK ANSI_STYLE(5) //!< Display terminal output text which blinks every second (only in tty and xterm) +#define ANSI_STYLE_UNKNOWN ANSI_STYLE(6) //!< ??? +#define ANSI_STYLE_INVERTED ANSI_STYLE(7) //!< Display terminal output text with the background/foreground colors reversed +#define ANSI_STYLE_HIDDEN ANSI_STYLE(8) //!< Write, but do not display, the terminal output text (useful for passwords) +#define ANSI_STYLE_OVERLINE ANSI_STYLE(9) //!< Display terminal output text with an overline (a.k.a strikethrough) + +#define ANSI_RESET_BOLD ANSI_STYLE(21) //!< Undoes the effects of #ANSI_RESET_BOLD +#define ANSI_RESET_DIM ANSI_STYLE(22) //!< Undoes the effects of #ANSI_RESET_DIM +#define ANSI_RESET_ITALIC ANSI_STYLE(23) //!< Undoes the effects of #ANSI_RESET_ITALIC +#define ANSI_RESET_UNDERLINE ANSI_STYLE(24) //!< Undoes the effects of #ANSI_RESET_UNDERLINE +#define ANSI_RESET_BLINK ANSI_STYLE(25) //!< Undoes the effects of #ANSI_RESET_BLINK +#define ANSI_RESET_UKNOWN ANSI_STYLE(26) //!< Undoes the effects of #ANSI_RESET_UKNOWN +#define ANSI_RESET_INVERTED ANSI_STYLE(27) //!< Undoes the effects of #ANSI_RESET_INVERTED +#define ANSI_RESET_HIDDEN ANSI_STYLE(28) //!< Undoes the effects of #ANSI_RESET_HIDDEN +#define ANSI_RESET_OVERLINE ANSI_STYLE(29) //!< Undoes the effects of #ANSI_RESET_OVERLINE //! ANSI Color code (255-map, not supported on certain old terminals) /*! @@ -92,49 +99,66 @@ HEADER_CPP ** @see ** - IO_GetColor() */ -#define IO_COLOR_FG(CODE) ANSI("38;5;"CODE"") +#define ANSI_COLOR_FG(CODE) ANSI_STYLE("38;5;"#CODE) + +#define ANSI_COLOR_FG_BLACK ANSI_STYLE(30) //!< The string sequence to color the terminal text output black +#define ANSI_COLOR_FG_RED ANSI_STYLE(31) //!< The string sequence to color the terminal text output red +#define ANSI_COLOR_FG_GREEN ANSI_STYLE(32) //!< The string sequence to color the terminal text output green +#define ANSI_COLOR_FG_YELLOW ANSI_STYLE(33) //!< The string sequence to color the terminal text output yellow +#define ANSI_COLOR_FG_BLUE ANSI_STYLE(34) //!< The string sequence to color the terminal text output blue +#define ANSI_COLOR_FG_MAGENTA ANSI_STYLE(35) //!< The string sequence to color the terminal text output magenta +#define ANSI_COLOR_FG_CYAN ANSI_STYLE(36) //!< The string sequence to color the terminal text output cyan +#define ANSI_COLOR_FG_GRAY_LIGHT ANSI_STYLE(37) //!< The string sequence to color the terminal text output light gray +#define ANSI_COLOR_FG_GRAY_DARK ANSI_STYLE(90) //!< The string sequence to color the terminal text output dark gray +#define ANSI_COLOR_FG_RED_LIGHT ANSI_STYLE(91) //!< The string sequence to color the terminal text output light red +#define ANSI_COLOR_FG_GREEN_LIGHT ANSI_STYLE(92) //!< The string sequence to color the terminal text output light green +#define ANSI_COLOR_FG_YELLOW_LIGHT ANSI_STYLE(93) //!< The string sequence to color the terminal text output light yellow +#define ANSI_COLOR_FG_BLUE_LIGHT ANSI_STYLE(94) //!< The string sequence to color the terminal text output light blue +#define ANSI_COLOR_FG_MAGENTA_LIGHT ANSI_STYLE(95) //!< The string sequence to color the terminal text output light magenta +#define ANSI_COLOR_FG_CYAN_LIGHT ANSI_STYLE(96) //!< The string sequence to color the terminal text output light cyan +#define ANSI_COLOR_FG_WHITE ANSI_STYLE(97) //!< The string sequence to color the terminal text output white //! The string sequence to color the terminal text output with the default color for this terminal -#define IO_COLOR_FG_DEFAULT ANSI("39") - -#define IO_COLOR_BG_BLACK ANSI("40") //!< The string sequence to color the terminal text background/highlight black -#define IO_COLOR_BG_RED ANSI("41") //!< The string sequence to color the terminal text background/highlight red -#define IO_COLOR_BG_GREEN ANSI("42") //!< The string sequence to color the terminal text background/highlight green -#define IO_COLOR_BG_YELLOW ANSI("43") //!< The string sequence to color the terminal text background/highlight yellow -#define IO_COLOR_BG_BLUE ANSI("44") //!< The string sequence to color the terminal text background/highlight blue -#define IO_COLOR_BG_MAGENTA ANSI("45") //!< The string sequence to color the terminal text background/highlight magenta -#define IO_COLOR_BG_CYAN ANSI("46") //!< The string sequence to color the terminal text background/highlight cyan -#define IO_COLOR_BG_GRAY_LIGHT ANSI("47") //!< The string sequence to color the terminal text background/highlight light gray -#define IO_COLOR_BG_GRAY_DARK ANSI("100") //!< The string sequence to color the terminal text background/highlight dark gray -#define IO_COLOR_BG_RED_LIGHT ANSI("101") //!< The string sequence to color the terminal text background/highlight light red -#define IO_COLOR_BG_GREEN_LIGHT ANSI("102") //!< The string sequence to color the terminal text background/highlight light green -#define IO_COLOR_BG_YELLOW_LIGHT ANSI("103") //!< The string sequence to color the terminal text background/highlight light yellow -#define IO_COLOR_BG_BLUE_LIGHT ANSI("104") //!< The string sequence to color the terminal text background/highlight light blue -#define IO_COLOR_BG_MAGENTA_LIGHT ANSI("105") //!< The string sequence to color the terminal text background/highlight light magenta -#define IO_COLOR_BG_CYAN_LIGHT ANSI("106") //!< The string sequence to color the terminal text background/highlight light cyan -#define IO_COLOR_BG_WHITE ANSI("107") //!< The string sequence to color the terminal text background/highlight white +#define ANSI_COLOR_FG_DEFAULT ANSI_STYLE(39) //! ANSI Color code (255-map, not supported on certain old terminals) /*! ** @param CODE should be a string, containing number between 0 and 255 ** @see IO_GetColor() */ -#define IO_COLOR_BG(CODE) ANSI("48;5;"CODE"") +#define ANSI_COLOR_BG(CODE) ANSI_STYLE("48;5;"#CODE) + +#define ANSI_COLOR_BG_BLACK ANSI_STYLE(40) //!< The string sequence to color the terminal text background/highlight black +#define ANSI_COLOR_BG_RED ANSI_STYLE(41) //!< The string sequence to color the terminal text background/highlight red +#define ANSI_COLOR_BG_GREEN ANSI_STYLE(42) //!< The string sequence to color the terminal text background/highlight green +#define ANSI_COLOR_BG_YELLOW ANSI_STYLE(43) //!< The string sequence to color the terminal text background/highlight yellow +#define ANSI_COLOR_BG_BLUE ANSI_STYLE(44) //!< The string sequence to color the terminal text background/highlight blue +#define ANSI_COLOR_BG_MAGENTA ANSI_STYLE(45) //!< The string sequence to color the terminal text background/highlight magenta +#define ANSI_COLOR_BG_CYAN ANSI_STYLE(46) //!< The string sequence to color the terminal text background/highlight cyan +#define ANSI_COLOR_BG_GRAY_LIGHT ANSI_STYLE(47) //!< The string sequence to color the terminal text background/highlight light gray +#define ANSI_COLOR_BG_GRAY_DARK ANSI_STYLE(100) //!< The string sequence to color the terminal text background/highlight dark gray +#define ANSI_COLOR_BG_RED_LIGHT ANSI_STYLE(101) //!< The string sequence to color the terminal text background/highlight light red +#define ANSI_COLOR_BG_GREEN_LIGHT ANSI_STYLE(102) //!< The string sequence to color the terminal text background/highlight light green +#define ANSI_COLOR_BG_YELLOW_LIGHT ANSI_STYLE(103) //!< The string sequence to color the terminal text background/highlight light yellow +#define ANSI_COLOR_BG_BLUE_LIGHT ANSI_STYLE(104) //!< The string sequence to color the terminal text background/highlight light blue +#define ANSI_COLOR_BG_MAGENTA_LIGHT ANSI_STYLE(105) //!< The string sequence to color the terminal text background/highlight light magenta +#define ANSI_COLOR_BG_CYAN_LIGHT ANSI_STYLE(106) //!< The string sequence to color the terminal text background/highlight light cyan +#define ANSI_COLOR_BG_WHITE ANSI_STYLE(107) //!< The string sequence to color the terminal text background/highlight white //! The string sequence to color the terminal text background with the default color for this terminal -#define IO_COLOR_BG_DEFAULT ANSI("49") +#define ANSI_COLOR_BG_DEFAULT ANSI_STYLE(49) //! @} #ifndef __COLORS__ #define __COLORS__ -#define C_RESET ANSI("0") //!< The string sequence to reset the terminal text output to its default color -#define C_RED ANSI("31") //!< The string sequence to color the terminal text output red -#define C_GREEN ANSI("32") //!< The string sequence to color the terminal text output green -#define C_YELLOW ANSI("33") //!< The string sequence to color the terminal text output yellow -#define C_BLUE ANSI("34") //!< The string sequence to color the terminal text output blue -#define C_MAGENTA ANSI("35") //!< The string sequence to color the terminal text output magenta -#define C_CYAN ANSI("36") //!< The string sequence to color the terminal text output cyan +#define ANSI_RESET ANSI_STYLE(0) //!< The string sequence to reset the terminal text output to its default color +#define ANSI_COLOR_FG_RED ANSI_STYLE(31) //!< The string sequence to color the terminal text output red +#define ANSI_COLOR_FG_GREEN ANSI_STYLE(32) //!< The string sequence to color the terminal text output green +#define ANSI_COLOR_FG_YELLOW ANSI_STYLE(33) //!< The string sequence to color the terminal text output yellow +#define ANSI_COLOR_FG_BLUE ANSI_STYLE(34) //!< The string sequence to color the terminal text output blue +#define ANSI_COLOR_FG_MAGENTA ANSI_STYLE(35) //!< The string sequence to color the terminal text output magenta +#define ANSI_COLOR_FG_CYAN ANSI_STYLE(36) //!< The string sequence to color the terminal text output cyan #endif diff --git a/src/sys/logger/core.c b/src/sys/logger/core.c index c296a7ab..0c9aab30 100644 --- a/src/sys/logger/core.c +++ b/src/sys/logger/core.c @@ -157,7 +157,7 @@ e_cccerror Log_VA(s_logger const* logger, if (prefix && prefix[0] != '\0') { if (prefix_color && logger->format == LOGFORMAT_ANSI) - prefix_str = String_Format("%s%s"C_RESET": ", prefix_color, prefix); + prefix_str = String_Format("%s%s"ANSI_RESET": ", prefix_color, prefix); else prefix_str = String_Format("%s: ", prefix); } diff --git a/src/sys/logger/log.c b/src/sys/logger/log.c index 7e805c26..966e5491 100644 --- a/src/sys/logger/log.c +++ b/src/sys/logger/log.c @@ -29,11 +29,11 @@ e_cccerror Log_Error(s_logger const* logger, t_char const* error, t_char const* format_str, ...) { - LOGONE_FUNCTION_CONTENT((logger->silence_errors), OK, error, LOGPREFIX_ERROR, IO_COLOR_FG_RED, ) + LOGONE_FUNCTION_CONTENT((logger->silence_errors), OK, error, LOGPREFIX_ERROR, ANSI_COLOR_FG_RED, ) } e_cccerror LogAll_Error(t_logptrarr const loggers, t_char const* error, t_char const* format_str, ...) { - LOGALL_FUNCTION_CONTENT((logger->silence_errors), OK, error, LOGPREFIX_ERROR, IO_COLOR_FG_RED, ) + LOGALL_FUNCTION_CONTENT((logger->silence_errors), OK, error, LOGPREFIX_ERROR, ANSI_COLOR_FG_RED, ) } e_cccerror Log_Error_STD(s_logger const* logger, t_errno error, t_char const* format_str, ...) @@ -41,14 +41,14 @@ e_cccerror Log_Error_STD(s_logger const* logger, t_errno error, t_char con t_char const* errorname = Error_STD_Name(error); t_char const* error_msg = Error_STD_Message(error); t_char* prefix = String_Format(LOGPREFIX_ERROR"[STD:%d:%s]", error, errorname); - LOGONE_FUNCTION_CONTENT((logger->silence_errors), error, error_msg, prefix, IO_COLOR_FG_RED, String_Delete(&prefix);) + LOGONE_FUNCTION_CONTENT((logger->silence_errors), error, error_msg, prefix, ANSI_COLOR_FG_RED, String_Delete(&prefix);) } e_cccerror LogAll_Error_STD(t_logptrarr const loggers, t_errno error, t_char const* format_str, ...) { t_char const* errorname = Error_STD_Name(error); t_char const* error_msg = Error_STD_Message(error); t_char* prefix = String_Format(LOGPREFIX_ERROR"[STD:%d:%s]", error, errorname); - LOGALL_FUNCTION_CONTENT((logger->silence_errors), error, error_msg, prefix, IO_COLOR_FG_RED, String_Delete(&prefix);) + LOGALL_FUNCTION_CONTENT((logger->silence_errors), error, error_msg, prefix, ANSI_COLOR_FG_RED, String_Delete(&prefix);) } e_cccerror Log_Error_CCC(s_logger const* logger, e_cccerror error, t_char const* format_str, ...) @@ -58,14 +58,14 @@ e_cccerror Log_Error_CCC(s_logger const* logger, e_cccerror error, t_char t_char const* errorname = Error_STD_Name(errno); t_char const* error_msg = Error_STD_Message(errno); t_char* prefix = String_Format(LOGPREFIX_ERROR"[STD:%d:%s]", errno, errorname); - LOGONE_FUNCTION_CONTENT((logger->silence_errors), errno, error_msg, prefix, IO_COLOR_FG_RED, String_Delete(&prefix);) + LOGONE_FUNCTION_CONTENT((logger->silence_errors), errno, error_msg, prefix, ANSI_COLOR_FG_RED, String_Delete(&prefix);) } else { t_char const* errorname = Error_CCC_Name(error); t_char const* error_msg = Error_CCC_Message(error); t_char* prefix = String_Format(LOGPREFIX_ERROR"[CCC:%d:%s]", error, errorname); - LOGONE_FUNCTION_CONTENT((logger->silence_errors), error, error_msg, prefix, IO_COLOR_FG_RED, String_Delete(&prefix);) + LOGONE_FUNCTION_CONTENT((logger->silence_errors), error, error_msg, prefix, ANSI_COLOR_FG_RED, String_Delete(&prefix);) } } e_cccerror LogAll_Error_CCC(t_logptrarr const loggers, e_cccerror error, t_char const* format_str, ...) @@ -75,25 +75,25 @@ e_cccerror LogAll_Error_CCC(t_logptrarr const loggers, e_cccerror error, t_char t_char const* errorname = Error_STD_Name(errno); t_char const* error_msg = Error_STD_Message(errno); t_char* prefix = String_Format(LOGPREFIX_ERROR"[STD:%d:%s]", errno, errorname); - LOGALL_FUNCTION_CONTENT((logger->silence_errors), errno, error_msg, prefix, IO_COLOR_FG_RED, String_Delete(&prefix);) + LOGALL_FUNCTION_CONTENT((logger->silence_errors), errno, error_msg, prefix, ANSI_COLOR_FG_RED, String_Delete(&prefix);) } else { t_char const* errorname = Error_CCC_Name(error); t_char const* error_msg = Error_CCC_Message(error); t_char* prefix = String_Format(LOGPREFIX_ERROR"[CCC:%d:%s]", error, errorname); - LOGALL_FUNCTION_CONTENT((logger->silence_errors), error, error_msg, prefix, IO_COLOR_FG_RED, String_Delete(&prefix);) + LOGALL_FUNCTION_CONTENT((logger->silence_errors), error, error_msg, prefix, ANSI_COLOR_FG_RED, String_Delete(&prefix);) } } -e_cccerror Log_Failure(s_logger const* logger, t_char const* format_str, ...) { LOGONE_FUNCTION_CONTENT((logger->silence_errors), OK, NULL, LOGPREFIX_FAILURE, IO_COLOR_FG_RED, ) } -e_cccerror LogAll_Failure(t_logptrarr const loggers, t_char const* format_str, ...) { LOGALL_FUNCTION_CONTENT((logger->silence_errors), OK, NULL, LOGPREFIX_FAILURE, IO_COLOR_FG_RED, ) } -e_cccerror Log_Warning(s_logger const* logger, t_char const* format_str, ...) { LOGONE_FUNCTION_CONTENT((logger->silence_logs), OK, NULL, LOGPREFIX_WARNING, IO_COLOR_FG_YELLOW, ) } -e_cccerror LogAll_Warning(t_logptrarr const loggers, t_char const* format_str, ...) { LOGALL_FUNCTION_CONTENT((logger->silence_logs), OK, NULL, LOGPREFIX_WARNING, IO_COLOR_FG_YELLOW, ) } -e_cccerror Log_Success(s_logger const* logger, t_char const* format_str, ...) { LOGONE_FUNCTION_CONTENT((logger->silence_logs), OK, NULL, LOGPREFIX_SUCCESS, IO_COLOR_FG_GREEN, ) } -e_cccerror LogAll_Success(t_logptrarr const loggers, t_char const* format_str, ...) { LOGALL_FUNCTION_CONTENT((logger->silence_logs), OK, NULL, LOGPREFIX_SUCCESS, IO_COLOR_FG_GREEN, ) } -e_cccerror Log_Message(s_logger const* logger, t_char const* format_str, ...) { LOGONE_FUNCTION_CONTENT((logger->silence_logs), OK, NULL, LOGPREFIX_MESSAGE, IO_COLOR_FG_BLUE, ) } -e_cccerror LogAll_Message(t_logptrarr const loggers, t_char const* format_str, ...) { LOGALL_FUNCTION_CONTENT((logger->silence_logs), OK, NULL, LOGPREFIX_MESSAGE, IO_COLOR_FG_BLUE, ) } -e_cccerror Log_Verbose(s_logger const* logger, t_char const* format_str, ...) { LOGONE_FUNCTION_CONTENT((logger->silence_logs || !logger->verbose), OK, NULL, LOGPREFIX_VERBOSE, IO_COLOR_FG_BLUE, ) } -e_cccerror LogAll_Verbose(t_logptrarr const loggers, t_char const* format_str, ...) { LOGALL_FUNCTION_CONTENT((logger->silence_logs || !logger->verbose), OK, NULL, LOGPREFIX_VERBOSE, IO_COLOR_FG_BLUE, ) } +e_cccerror Log_Failure(s_logger const* logger, t_char const* format_str, ...) { LOGONE_FUNCTION_CONTENT((logger->silence_errors), OK, NULL, LOGPREFIX_FAILURE, ANSI_COLOR_FG_RED, ) } +e_cccerror LogAll_Failure(t_logptrarr const loggers, t_char const* format_str, ...) { LOGALL_FUNCTION_CONTENT((logger->silence_errors), OK, NULL, LOGPREFIX_FAILURE, ANSI_COLOR_FG_RED, ) } +e_cccerror Log_Warning(s_logger const* logger, t_char const* format_str, ...) { LOGONE_FUNCTION_CONTENT((logger->silence_logs), OK, NULL, LOGPREFIX_WARNING, ANSI_COLOR_FG_YELLOW, ) } +e_cccerror LogAll_Warning(t_logptrarr const loggers, t_char const* format_str, ...) { LOGALL_FUNCTION_CONTENT((logger->silence_logs), OK, NULL, LOGPREFIX_WARNING, ANSI_COLOR_FG_YELLOW, ) } +e_cccerror Log_Success(s_logger const* logger, t_char const* format_str, ...) { LOGONE_FUNCTION_CONTENT((logger->silence_logs), OK, NULL, LOGPREFIX_SUCCESS, ANSI_COLOR_FG_GREEN, ) } +e_cccerror LogAll_Success(t_logptrarr const loggers, t_char const* format_str, ...) { LOGALL_FUNCTION_CONTENT((logger->silence_logs), OK, NULL, LOGPREFIX_SUCCESS, ANSI_COLOR_FG_GREEN, ) } +e_cccerror Log_Message(s_logger const* logger, t_char const* format_str, ...) { LOGONE_FUNCTION_CONTENT((logger->silence_logs), OK, NULL, LOGPREFIX_MESSAGE, ANSI_COLOR_FG_BLUE, ) } +e_cccerror LogAll_Message(t_logptrarr const loggers, t_char const* format_str, ...) { LOGALL_FUNCTION_CONTENT((logger->silence_logs), OK, NULL, LOGPREFIX_MESSAGE, ANSI_COLOR_FG_BLUE, ) } +e_cccerror Log_Verbose(s_logger const* logger, t_char const* format_str, ...) { LOGONE_FUNCTION_CONTENT((logger->silence_logs || !logger->verbose), OK, NULL, LOGPREFIX_VERBOSE, ANSI_COLOR_FG_BLUE, ) } +e_cccerror LogAll_Verbose(t_logptrarr const loggers, t_char const* format_str, ...) { LOGALL_FUNCTION_CONTENT((logger->silence_logs || !logger->verbose), OK, NULL, LOGPREFIX_VERBOSE, ANSI_COLOR_FG_BLUE, ) } diff --git a/src/sys/logger/util.c b/src/sys/logger/util.c index 2b4341f5..8610f480 100644 --- a/src/sys/logger/util.c +++ b/src/sys/logger/util.c @@ -52,7 +52,7 @@ e_cccerror Log_Fatal(s_logger const* logger, t_char const* str) t_bool is_sh; t_fd fd = (logger ? logger->fd : STDOUT); is_sh = IO_IsTerminal(fd); - prefix = (is_sh ? "libccc: "IO_COLOR_FG_RED"fatal"C_RESET": " : "libccc: fatal: "); + prefix = (is_sh ? "libccc: "ANSI_COLOR_FG_RED"fatal"ANSI_RESET": " : "libccc: fatal: "); result = write(fd, prefix, String_Length(prefix)); if (str) { @@ -65,14 +65,14 @@ e_cccerror Log_Fatal(s_logger const* logger, t_char const* str) if (logger == NULL) { result = printf( - IO_COLOR_FG_RED"Fatal Error"C_RESET": %s\n\t-> %s\n", + ANSI_COLOR_FG_RED"Fatal Error"ANSI_RESET": %s\n\t-> %s\n", (str ? str : ""), message); return (ERROR_NULLPOINTER); } if (logger->path && IO_IsTerminal(logger->fd)) { result = dprintf(logger->fd, - IO_COLOR_FG_RED"Fatal Error"C_RESET": %s\n\t-> %s\n", + ANSI_COLOR_FG_RED"Fatal Error"ANSI_RESET": %s\n\t-> %s\n", (str ? str : ""), message); } else diff --git a/src/sys/time/parse.c b/src/sys/time/parse.c index 83b9e776..4bb33d1a 100644 --- a/src/sys/time/parse.c +++ b/src/sys/time/parse.c @@ -77,7 +77,7 @@ __weak_alias(strptime,_strptime) /* Definitions */ /* ************************************************************************** */ -#define PARSINGERROR_DATE_MESSAGE IO_COLOR_FG_RED"DATE PARSE ERROR"C_RESET": " +#define PARSINGERROR_DATE_MESSAGE ANSI_COLOR_FG_RED"DATE PARSE ERROR"ANSI_RESET": " //! used to handle errors during parsing #define PARSINGERROR_DATE(MESSAGE, ...) \ if CCCERROR(TRUE, ERROR_PARSE, \ diff --git a/test/libccc/math/math.c b/test/libccc/math/math.c index 1db60e35..981cbdd9 100644 --- a/test/libccc/math/math.c +++ b/test/libccc/math/math.c @@ -24,7 +24,7 @@ void print_math_foreword(void) { if (g_test.config.verbose) { - printf("\n\n"C_BLUE"Floating-point (%d-bit %s precision) math functions"C_RESET"\n\n", + printf("\n\n"ANSI_COLOR_FG_BLUE"Floating-point (%d-bit %s precision) math functions"ANSI_RESET"\n\n", #if LIBCONFIG_FLOAT_BITS == 32 32, "IEEE single"); #endif @@ -44,7 +44,7 @@ void print_math_title(char const * title) { if (g_test.config.verbose) { - printf("\n\n"C_BLUE"%s"C_RESET"\n", title); + printf("\n\n"ANSI_COLOR_FG_BLUE"%s"ANSI_RESET"\n", title); } } @@ -61,16 +61,16 @@ void printf_colored(const char* label, t_float precision, t_float value) if (value == 0. || IS_NAN(value)) printf(SF_FORMAT"\n", "", value); else if (value < 0) - printf(SF_FORMAT"\n"C_RESET, C_RED, value); + printf(SF_FORMAT"\n"ANSI_RESET, ANSI_COLOR_FG_RED, value); else if (value > 0) - printf(SF_FORMAT"\n"C_RESET, C_GREEN, value); + printf(SF_FORMAT"\n"ANSI_RESET, ANSI_COLOR_FG_GREEN, value); } else { if (value < precision) - printf(SF_FORMAT"\n"C_RESET, C_GREEN, value); + printf(SF_FORMAT"\n"ANSI_RESET, ANSI_COLOR_FG_GREEN, value); else - printf(SF_FORMAT"\n"C_RESET, C_RED, value); + printf(SF_FORMAT"\n"ANSI_RESET, ANSI_COLOR_FG_RED, value); } } @@ -157,7 +157,7 @@ t_float c_get_largest_f(s_array_float values) ++failed_tests; \ if (g_test.config.verbose && g_test.config.show_args && precision < fabs(results[i] - expects[i])) \ { \ - printf("TEST N°%d: -> returned %g but libc returned %g (difference is "C_RED"%g"C_RESET")\n", \ + printf("TEST N°%d: -> returned %g but libc returned %g (difference is "ANSI_COLOR_FG_RED"%g"ANSI_RESET")\n", \ i, results[i], expects[i], errors.items[i]); \ } \ } \ diff --git a/test/libccc/random/random.c b/test/libccc/random/random.c index fb5988f7..befc3cfb 100644 --- a/test/libccc/random/random.c +++ b/test/libccc/random/random.c @@ -47,7 +47,7 @@ s_sorted_int print_test_random(int samples) for (int i = 0; i < result.length - 1; ++i) { if (result.items[i] > result.items[i + 1]) - printf(C_RED"Sorting error at index %d\n"C_RESET, i); + printf(ANSI_COLOR_FG_RED"Sorting error at index %d\n"ANSI_RESET, i); } c_stat_free_ilst(&values); */ diff --git a/test/libccc/text/char_ascii.c b/test/libccc/text/char_ascii.c index 83b0d949..0df2b888 100644 --- a/test/libccc/text/char_ascii.c +++ b/test/libccc/text/char_ascii.c @@ -46,7 +46,7 @@ { \ errors++; \ TEST_PERFORM_CHAR_##KIND(FUNCTION, \ - C_RED"Error"C_RESET": ") \ + ANSI_COLOR_FG_RED"Error"ANSI_RESET": ") \ g_test.suites[TESTSUITE_TEXT_CHAR_ASCII].totals.failed += 1;\ } \ else \ @@ -54,7 +54,7 @@ warnings++; \ if (g_test.config.verbose) \ TEST_PERFORM_CHAR_##KIND(FUNCTION, \ - C_YELLOW"Warning"C_RESET": ") \ + ANSI_COLOR_FG_YELLOW"Warning"ANSI_RESET": ") \ g_test.suites[TESTSUITE_TEXT_CHAR_ASCII].totals.warnings += 1;\ } \ } \ @@ -63,8 +63,8 @@ if (errors || warnings) \ { \ printf(#FUNCTION"(): tested every character from %u to %u, got in total:\n", min, max); \ - printf("- %s%d"C_RESET" errors""\n", (errors == 0 ? C_GREEN : C_RED), errors ); \ - printf("- %s%d"C_RESET" warnings\n", (warnings == 0 ? C_GREEN : C_YELLOW), warnings); \ + printf("- %s%d"ANSI_RESET" errors""\n", (errors == 0 ? ANSI_COLOR_FG_GREEN : ANSI_COLOR_FG_RED), errors ); \ + printf("- %s%d"ANSI_RESET" warnings\n", (warnings == 0 ? ANSI_COLOR_FG_GREEN : ANSI_COLOR_FG_YELLOW), warnings); \ } diff --git a/test/libccc/text/char_unicode.c b/test/libccc/text/char_unicode.c index b1b8fe86..84b22469 100644 --- a/test/libccc/text/char_unicode.c +++ b/test/libccc/text/char_unicode.c @@ -46,7 +46,7 @@ { \ errors++; \ TEST_PERFORM_CHAR_##KIND(FUNCTION, \ - C_RED"Error"C_RESET": ") \ + ANSI_COLOR_FG_RED"Error"ANSI_RESET": ") \ g_test.suites[TESTSUITE_TEXT_CHAR_UNICODE].totals.failed += 1;\ } \ else \ @@ -54,7 +54,7 @@ warnings++; \ if (g_test.config.verbose) \ TEST_PERFORM_CHAR_##KIND(FUNCTION, \ - C_YELLOW"Warning"C_RESET": ") \ + ANSI_COLOR_FG_YELLOW"Warning"ANSI_RESET": ") \ g_test.suites[TESTSUITE_TEXT_CHAR_UNICODE].totals.warnings += 1;\ } \ } \ @@ -63,8 +63,8 @@ if (errors || warnings) \ { \ printf(#FUNCTION"(): tested every character from %u to %u, got in total:\n", min, max); \ - printf("- %s%d"C_RESET" errors""\n", (errors == 0 ? C_GREEN : C_RED), errors ); \ - printf("- %s%d"C_RESET" warnings\n", (warnings == 0 ? C_GREEN : C_YELLOW), warnings); \ + printf("- %s%d"ANSI_RESET" errors""\n", (errors == 0 ? ANSI_COLOR_FG_GREEN : ANSI_COLOR_FG_RED), errors ); \ + printf("- %s%d"ANSI_RESET" warnings\n", (warnings == 0 ? ANSI_COLOR_FG_GREEN : ANSI_COLOR_FG_YELLOW), warnings); \ } diff --git a/test/standalone/kvt.c b/test/standalone/kvt.c index 3823a017..01c57b12 100644 --- a/test/standalone/kvt.c +++ b/test/standalone/kvt.c @@ -32,15 +32,15 @@ int main()//(int argc, char** argv) // #include "../"FILEPATH ; #endif - if (file == NULL) { IO_Output_Line(IO_COLOR_FG_RED"FILE ERROR"IO_RESET); return (ERROR); } + if (file == NULL) { IO_Output_Line(ANSI_COLOR_FG_RED"FILE ERROR"ANSI_RESET); return (ERROR); } for (t_uint i = 0; i < AMOUNT; ++i) { s_kvt* kvt; t_char* str; kvt = JSON_FromString(file); - if (kvt == NULL) { IO_Output_Line(IO_COLOR_FG_RED"PARSE ERROR"IO_RESET); return (ERROR); } + if (kvt == NULL) { IO_Output_Line(ANSI_COLOR_FG_RED"PARSE ERROR"ANSI_RESET); return (ERROR); } str = JSON_ToString(kvt); - if (str == NULL) { IO_Output_Line(IO_COLOR_FG_RED"PRINT ERROR"IO_RESET); return (ERROR); } + if (str == NULL) { IO_Output_Line(ANSI_COLOR_FG_RED"PRINT ERROR"ANSI_RESET); return (ERROR); } t_char* output = String_Format(SF_UINT":\t%.30s", i, str); IO_Output_Line((AMOUNT == 1) ? str : output); KVT_Delete(kvt); diff --git a/test/test.c b/test/test.c index 9717884d..249856c9 100644 --- a/test/test.c +++ b/test/test.c @@ -30,7 +30,7 @@ void test_cccerrorhandler(e_cccerror error, t_char const* funcname, t_char const t_char const* errorname = Error_CCC_Name(error); t_char const* error_msg = Error_CCC_Message(error); t_char* errorlog = String_Format( - "libccc: "C_RED"error[CCC:%d:%s]"C_RESET": %s -> %s -> %s%s", + "libccc: "ANSI_COLOR_FG_RED"error[CCC:%d:%s]"ANSI_RESET": %s -> %s -> %s%s", error, errorname, funcname, error_msg, message, (message == NULL || message[0] == '\0' || message[String_Length(message) - 1] != '\n') ? "\n" : ""); if (g_test.last_test_error == NULL) @@ -96,7 +96,7 @@ void print_test( (function[0] == '_' ? function + 1 : function), ' ')) printf("\n"); if (flags & FLAG_SIGNALMASK) - printf("%s - "C_YELLOW"can signal"C_RESET, test_name); + printf("%s - "ANSI_COLOR_FG_YELLOW"can signal"ANSI_RESET, test_name); else printf("%s", test_name); printf(" | "); } @@ -126,11 +126,11 @@ void print_test( { if (warning) { - printf(C_YELLOW"Warning"C_RESET": %s\n", warning); + printf(ANSI_COLOR_FG_YELLOW"Warning"ANSI_RESET": %s\n", warning); } else { - printf(C_YELLOW"Warning"C_RESET": failed test: %s\n" + printf(ANSI_COLOR_FG_YELLOW"Warning"ANSI_RESET": failed test: %s\n" "- received: (%s)\n" "- expected: (%s)\n", function, @@ -142,8 +142,8 @@ void print_test( else { if (str_equals(expect, "(n/a)")) - printf(C_RED"TEST COULD NOT BE PERFORMED\n"C_RESET); - else printf(C_RED"TEST FAILED:\n"); + printf(ANSI_COLOR_FG_RED"TEST COULD NOT BE PERFORMED\n"ANSI_RESET); + else printf(ANSI_COLOR_FG_RED"TEST FAILED:\n"); if (function[0] == '_') { static char const* expected = "Expected"; @@ -152,7 +152,7 @@ void print_test( length_expected = (length_expected > length_function) ? length_expected : length_function; length_function = length_expected - length_function + 1; printf(">%*.*s%s: (%s)\n" - ">%*.*s: (%s)\n"C_RESET, + ">%*.*s: (%s)\n"ANSI_RESET, length_function, length_function, "c", @@ -164,7 +164,7 @@ void print_test( else { printf( ">c_%s: (%s)\n" - "> %s: (%s)\n"C_RESET, + "> %s: (%s)\n"ANSI_RESET, function, result, function, expect); } @@ -173,13 +173,13 @@ void print_test( } else if (warning) { - printf(C_YELLOW"Warning"C_RESET": %s\n", warning); + printf(ANSI_COLOR_FG_YELLOW"Warning"ANSI_RESET": %s\n", warning); if (flags & FLAG_WARNING) g_test.suites[g_test.current_suite].totals.warnings += 1; } else if (g_test.config.verbose) { - printf(C_GREEN"OK!"C_RESET"\n"); + printf(ANSI_COLOR_FG_GREEN"OK!"ANSI_RESET"\n"); } fflush(stdout); fflush(stderr); @@ -448,13 +448,13 @@ void print_test_alloc(s_test_alloc* test, char const* args) } if (error) { - printf(C_RED"\nError"C_RESET": "); + printf(ANSI_COLOR_FG_RED"\nError"ANSI_RESET": "); if (test->result == NULL) printf("The call to c_%s(...) returned NULL.", test->function); else printf("Every char should be '\\0', but '%c' was read at index %zu.", test->result[i], i); } else if (g_test.config.verbose) - printf(C_GREEN"OK!"C_RESET); + printf(ANSI_COLOR_FG_GREEN"OK!"ANSI_RESET); */ } @@ -536,7 +536,7 @@ void print_test_list(s_test_list* test, char const* args) if (test->name) { if (test->flags) - printf("\n%s - "C_YELLOW"can segfault"C_RESET, test->name); + printf("\n%s - "ANSI_COLOR_FG_YELLOW"can segfault"ANSI_RESET, test->name); else printf("\n%s", test->name); printf(" -> "); } @@ -559,7 +559,7 @@ void print_test_list(s_test_list* test, char const* args) error = TRUE; if (error) { - printf(C_RED"Error:\n"); + printf(ANSI_COLOR_FG_RED"Error:\n"); lst = (s_list*)test->result; printf(">c_%s: [", test->function); char* tmp; @@ -578,9 +578,9 @@ void print_test_list(s_test_list* test, char const* args) printf("%s{%s}", (i == 0 ? "" : ", "), test->expect[i]); ++i; } - printf("]\n"C_RESET); + printf("]\n"ANSI_RESET); } - else printf(C_GREEN"OK!"C_RESET); + else printf(ANSI_COLOR_FG_GREEN"OK!"ANSI_RESET); } */ diff --git a/test/test_timer.c b/test/test_timer.c index 9973b245..5c8f101c 100644 --- a/test/test_timer.c +++ b/test/test_timer.c @@ -100,9 +100,9 @@ void print_timer_result(s_timer* t, t_s64 compare) if (compare == 0) printf("%s, libc:", result1); else if (compare < 0) - printf(C_GREEN"%s"C_RESET", libc:", result1); + printf(ANSI_COLOR_FG_GREEN"%s"ANSI_RESET", libc:", result1); else - printf(C_RED"%s"C_RESET", libc:", result1); + printf(ANSI_COLOR_FG_RED"%s"ANSI_RESET", libc:", result1); printf("%s]", result2); } diff --git a/test/test_utils.h b/test/test_utils.h index a157e3f1..041b3096 100644 --- a/test/test_utils.h +++ b/test/test_utils.h @@ -39,13 +39,13 @@ typedef struct list_int s_list_int ; //!< @see "libccc/monad/list.h" */ #ifndef __COLORS__ #define __COLORS__ -#define C_RED "\x1b[31m" -#define C_GREEN "\x1b[32m" -#define C_YELLOW "\x1b[33m" -#define C_BLUE "\x1b[34m" -#define C_MAGENTA "\x1b[35m" -#define C_CYAN "\x1b[36m" -#define C_RESET "\x1b[0m" +#define ANSI_COLOR_FG_RED "\x1b[31m" +#define ANSI_COLOR_FG_GREEN "\x1b[32m" +#define ANSI_COLOR_FG_YELLOW "\x1b[33m" +#define ANSI_COLOR_FG_BLUE "\x1b[34m" +#define ANSI_COLOR_FG_MAGENTA "\x1b[35m" +#define ANSI_COLOR_FG_CYAN "\x1b[36m" +#define ANSI_RESET "\x1b[0m" #endif diff --git a/test/util_print.c b/test/util_print.c index 82d0cd69..4bdb4ca9 100644 --- a/test/util_print.c +++ b/test/util_print.c @@ -17,7 +17,7 @@ void print_error(char const* format_error, ...) { va_list args; - printf(C_RED"Error"C_RESET": "); + printf(ANSI_COLOR_FG_RED"Error"ANSI_RESET": "); va_start(args, format_error); vprintf(format_error, args); va_end(args); @@ -29,11 +29,11 @@ void print_error(char const* format_error, ...) void print_percent(double percent) { char const* color; - if (percent >= 100) color = C_GREEN; - else if (percent >= 90) color = C_YELLOW; - else if (percent >= 0) color = C_RED; - else color = C_RESET; - printf("%s%g%%"C_RESET"\n", color, percent); + if (percent >= 100) color = ANSI_COLOR_FG_GREEN; + else if (percent >= 90) color = ANSI_COLOR_FG_YELLOW; + else if (percent >= 0) color = ANSI_COLOR_FG_RED; + else color = ANSI_RESET; + printf("%s%g%%"ANSI_RESET"\n", color, percent); } @@ -51,11 +51,11 @@ void print_totals(int amount, int failed, int warnings, char const* suite_name) printf("- Amount of tests: %d\n", amount); int passed = amount - failed; - printf("- Tests: %s%d failed"C_RESET" / %s%d passed"C_RESET"\n", - (failed == 0 ? C_GREEN : C_RED), failed, - (amount ? (passed == amount ? C_GREEN : C_YELLOW) : C_RED), passed); + printf("- Tests: %s%d failed"ANSI_RESET" / %s%d passed"ANSI_RESET"\n", + (failed == 0 ? ANSI_COLOR_FG_GREEN : ANSI_COLOR_FG_RED), failed, + (amount ? (passed == amount ? ANSI_COLOR_FG_GREEN : ANSI_COLOR_FG_YELLOW) : ANSI_COLOR_FG_RED), passed); if (warnings) - printf("- Warnings: "C_YELLOW"%d warnings issued"C_RESET"\n", warnings); + printf("- Warnings: "ANSI_COLOR_FG_YELLOW"%d warnings issued"ANSI_RESET"\n", warnings); printf("- Success rate: "); if (amount == 0) print_percent(0); @@ -64,9 +64,9 @@ void print_totals(int amount, int failed, int warnings, char const* suite_name) { if (failed) { - printf("\n"C_RED"FAIL: Failed %d out of %d tests in total."C_RESET"\n", failed, amount); + printf("\n"ANSI_COLOR_FG_RED"FAIL: Failed %d out of %d tests in total."ANSI_RESET"\n", failed, amount); } - else printf("\n"C_GREEN"SUCCESS: All tests passed."C_RESET"\n"); + else printf("\n"ANSI_COLOR_FG_GREEN"SUCCESS: All tests passed."ANSI_RESET"\n"); } printf("\n"); } @@ -87,11 +87,11 @@ int print_results(s_test_suite const* suites) for (int i = 0; i < TEST_SUITE_AMOUNT; ++i) { percent = (suites[i].totals.tests == 0 ? 100. : ((suites[i].totals.tests - suites[i].totals.failed) * 100. / suites[i].totals.tests)); - printf(" - %-20s: (%s%8d"C_RESET" tests, %s%8d"C_RESET" failed, %s%8d"C_RESET" warnings)\t-> ", + printf(" - %-20s: (%s%8d"ANSI_RESET" tests, %s%8d"ANSI_RESET" failed, %s%8d"ANSI_RESET" warnings)\t-> ", suites[i].name, - (suites[i].totals.tests == 0 ? C_YELLOW : ""), suites[i].totals.tests, - (suites[i].totals.failed == 0 ? C_GREEN : C_RED), suites[i].totals.failed, - (suites[i].totals.warnings == 0 ? C_GREEN : C_YELLOW), suites[i].totals.warnings); + (suites[i].totals.tests == 0 ? ANSI_COLOR_FG_YELLOW : ""), suites[i].totals.tests, + (suites[i].totals.failed == 0 ? ANSI_COLOR_FG_GREEN : ANSI_COLOR_FG_RED), suites[i].totals.failed, + (suites[i].totals.warnings == 0 ? ANSI_COLOR_FG_GREEN : ANSI_COLOR_FG_YELLOW), suites[i].totals.warnings); print_percent(percent); total_tests += suites[i].totals.tests; total_failed += suites[i].totals.failed; @@ -154,7 +154,7 @@ void print_title(void) printf(" ==> from https://github.com/lexouduck/libccc.git \n"); printf("==================================================\n"); printf("\n"); - printf(C_YELLOW"NB: All the tests with written in yellow 'can segfault' are NULL pointer tests of some kind."C_RESET"\n\n"); + printf(ANSI_COLOR_FG_YELLOW"NB: All the tests with written in yellow 'can segfault' are NULL pointer tests of some kind."ANSI_RESET"\n\n"); fflush(stdout); } @@ -166,8 +166,8 @@ void print_endian_warning(void) { int n = 1; if (*(char *)&n == 1) - printf(C_GREEN"/!\\ Your machine is little-endian (all tests should work reliably and can be trusted)"C_RESET"\n\n"); - else printf(C_RED"/!\\ Your machine is not little-endian (errors may arise in certain tests which handle memory directly)"C_RESET"\n\n"); + printf(ANSI_COLOR_FG_GREEN"/!\\ Your machine is little-endian (all tests should work reliably and can be trusted)"ANSI_RESET"\n\n"); + else printf(ANSI_COLOR_FG_RED"/!\\ Your machine is not little-endian (errors may arise in certain tests which handle memory directly)"ANSI_RESET"\n\n"); } fflush(stdout); } @@ -179,7 +179,7 @@ void print_nonstd(void) if (g_test.config.verbose) { printf("\n\n"); - printf(C_BLUE"================ NON-STD FUNCTIONS ================"C_RESET + printf(ANSI_COLOR_FG_BLUE"================ NON-STD FUNCTIONS ================"ANSI_RESET "\n""The following tests are for the functions of this category" "\n""which are not present in the ISO standard C library.\n"); } From d6b150bf62e48bce976ebbcfba929be40803c6ff Mon Sep 17 00:00:00 2001 From: lexouduck Date: Thu, 14 Mar 2024 17:23:51 +0900 Subject: [PATCH 2/8] fix(libccc/sys/ansi.h): small fix to inner stringization of new ANSI_CURSOR_* macros --- VERSION | 2 +- hdr/libccc/sys/ansi.h | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/VERSION b/VERSION index 5fe12cc6..d6a20512 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -libccc@0.11.33-2024-03-14_d971ce0827c8cad9659b12d18a65c935dbc1f18c +libccc@0.11.34-2024-03-14_44088ceecc538ebfae30d6a7ba929decd44a02dc diff --git a/hdr/libccc/sys/ansi.h b/hdr/libccc/sys/ansi.h index c1d11a9b..8d833418 100644 --- a/hdr/libccc/sys/ansi.h +++ b/hdr/libccc/sys/ansi.h @@ -42,22 +42,22 @@ HEADER_CPP #define ANSI_CURSOR_SAVE() "\x1B 7" //!< A special ANSI escape code to save the current position of the cursor (DEC). #define ANSI_CURSOR_LOAD() "\x1B 8" //!< A special ANSI escape code to restore the cursor to its last saved position (DEC). #define ANSI_CURSOR_MOVE(LINE, COLUMN) "\x1B["#LINE";"#COLUMN"H" //!< A special ANSI escape code to move the cursor to the specified position. -#define ANSI_CURSOR_MOVE_UP(LINES) ANSI_ESC('A', LINES) //!< A special ANSI escape code to move the cursor up # lines. -#define ANSI_CURSOR_MOVE_DOWN(LINES) ANSI_ESC('B', LINES) //!< A special ANSI escape code to move the cursor down # lines. -#define ANSI_CURSOR_MOVE_RIGHT(LINES) ANSI_ESC('C', LINES) //!< A special ANSI escape code to move the cursor right # columns. -#define ANSI_CURSOR_MOVE_LEFT(LINES) ANSI_ESC('D', LINES) //!< A special ANSI escape code to move the cursor left # columns. -#define ANSI_CURSOR_NEXTLINE(LINES) ANSI_ESC('E', LINES) //!< A special ANSI escape code to put the cursor at the beginning of the next line, # lines down. -#define ANSI_CURSOR_PREVLINE(LINES) ANSI_ESC('F', LINES) //!< A special ANSI escape code to put the cursor at the beginning of the previous line, # lines up. +#define ANSI_CURSOR_MOVE_UP(LINES) ANSI_ESC("A", LINES) //!< A special ANSI escape code to move the cursor up # lines. +#define ANSI_CURSOR_MOVE_DOWN(LINES) ANSI_ESC("B", LINES) //!< A special ANSI escape code to move the cursor down # lines. +#define ANSI_CURSOR_MOVE_RIGHT(LINES) ANSI_ESC("C", LINES) //!< A special ANSI escape code to move the cursor right # columns. +#define ANSI_CURSOR_MOVE_LEFT(LINES) ANSI_ESC("D", LINES) //!< A special ANSI escape code to move the cursor left # columns. +#define ANSI_CURSOR_NEXTLINE(LINES) ANSI_ESC("E", LINES) //!< A special ANSI escape code to put the cursor at the beginning of the next line, # lines down. +#define ANSI_CURSOR_PREVLINE(LINES) ANSI_ESC("F", LINES) //!< A special ANSI escape code to put the cursor at the beginning of the previous line, # lines up. // ANSI erase functions -#define ANSI_ERASE_SCREEN_AFTER ANSI_ESC('J', 0) //!< A special ANSI escape code to erase from cursor until end of screen. -#define ANSI_ERASE_SCREEN_BEFORE ANSI_ESC('J', 1) //!< A special ANSI escape code to erase from cursor to beginning of screen. -#define ANSI_ERASE_SCREEN ANSI_ESC('J', 2) //!< A special ANSI escape code to erase the entire screen. -#define ANSI_ERASE_SAVED ANSI_ESC('J', 3) //!< A special ANSI escape code to erase all saved lines. -#define ANSI_ERASE_LINE_AFTER ANSI_ESC('K', 0) //!< A special ANSI escape code to erase from cursor to end of line. -#define ANSI_ERASE_LINE_BEFORE ANSI_ESC('K', 1) //!< A special ANSI escape code to erase start of line to the cursor. -#define ANSI_ERASE_LINE ANSI_ESC('K', 2) //!< A special ANSI escape code to erase the entire line. +#define ANSI_ERASE_SCREEN_AFTER ANSI_ESC("J", 0) //!< A special ANSI escape code to erase from cursor until end of screen. +#define ANSI_ERASE_SCREEN_BEFORE ANSI_ESC("J", 1) //!< A special ANSI escape code to erase from cursor to beginning of screen. +#define ANSI_ERASE_SCREEN ANSI_ESC("J", 2) //!< A special ANSI escape code to erase the entire screen. +#define ANSI_ERASE_SAVED ANSI_ESC("J", 3) //!< A special ANSI escape code to erase all saved lines. +#define ANSI_ERASE_LINE_AFTER ANSI_ESC("K", 0) //!< A special ANSI escape code to erase from cursor to end of line. +#define ANSI_ERASE_LINE_BEFORE ANSI_ESC("K", 1) //!< A special ANSI escape code to erase start of line to the cursor. +#define ANSI_ERASE_LINE ANSI_ESC("K", 2) //!< A special ANSI escape code to erase the entire line. // ANSI color & style functions From 753a5679201c357e5e35ea692fffa3c01d956560 Mon Sep 17 00:00:00 2001 From: lexouduck Date: Thu, 14 Mar 2024 17:25:33 +0900 Subject: [PATCH 3/8] release(libccc): updated minor version after breaking change --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index d6a20512..f74aec54 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -libccc@0.11.34-2024-03-14_44088ceecc538ebfae30d6a7ba929decd44a02dc +libccc@0.12.0-2024-03-14_48a7a5ec0376e5be1aef83ac3f33f8b96156ba5d From 34b5dd5771ae6de3a9b0ea4f54bc45402fb9e021 Mon Sep 17 00:00:00 2001 From: lexouduck Date: Mon, 30 Sep 2024 18:22:26 +0900 Subject: [PATCH 4/8] ci(github): updated upload-artifacts to latest v4 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e5a349ba..500287e7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -76,7 +76,7 @@ jobs: run: make BUILDMODE=release dist - name: Upload build binary artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: libccc-build_${{matrix.os}}_${{matrix.compiler}} path: ./dist/*.zip From 860f9b37dd0545042b805f5c8ce20c890d847363 Mon Sep 17 00:00:00 2001 From: Alexis Duquesne Date: Tue, 1 Oct 2024 06:19:57 +0000 Subject: [PATCH 5/8] ci(github): updated 'checkout' action to latest v4 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 500287e7..68898cd7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 From 9e2fa75975ac65018c6dd50e2eaac58efe47c98f Mon Sep 17 00:00:00 2001 From: Alexis Duquesne Date: Tue, 1 Oct 2024 07:37:12 +0000 Subject: [PATCH 6/8] fix(mkfile/help): added double-quotes to paths, to allow mk file system to work properly even when in a filepath containing spaces --- Makefile | 2 +- mkfile/utils/help.mk | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 540e9fbb..a8be3ea0 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ # NOTE: the two following variables are to stay at the very top of this Makefile and never move #! The complete absolute path of the root-level makefile -MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +MKFILE_PATH := "$(abspath $(lastword $(MAKEFILE_LIST)))" #! The directory of the root-level makefile CURRENT_DIR := $(patsubst %/,%,$(dir $(MKFILE_PATH))) #! The sub-directory in which makefile scripts are stored diff --git a/mkfile/utils/help.mk b/mkfile/utils/help.mk index 6cdf49a4..b2227734 100644 --- a/mkfile/utils/help.mk +++ b/mkfile/utils/help.mk @@ -7,15 +7,15 @@ $(error To use the 'help.mk' utils, you must set the 'MKFILE_PATH' variable) endif #! The list of files included by the root-level makefile (and any sub-included) -MKFILES := $(shell cat $(MKFILE_PATH) | grep '^include\b' | cut -d' ' -f 2-) -$(eval MKFILES := $(MKFILE_PATH) $(MKFILES)) -MKFILES := $(MKFILES) $(shell cat $(MKFILES) | grep '^include\b' | cut -d' ' -f 2-) +MKFILES := $(shell cat $(MKFILE_PATH) | grep '^include\b' | cut -d' ' -f 2-) +$(eval MKFILES := $(MKFILE_PATH) $(MKFILES)) +MKFILES := $(MKFILES) $(shell cat $(MKFILES) | grep '^include\b' | cut -d' ' -f 2-) $(eval MKFILES := $(MKFILES)) -MKFILES := $(shell echo "$(MKFILES)" | tr '[:space:]' '\n' | awk '!x[$$0]++') +# replace spaces with newlines, and remove any duplicate filepaths in the list +MKFILES := $(shell ( for i in $(MKFILES) ; do echo "\"$$i\"" ; done ) | awk '!x[$$0]++') # make all paths be relative to project root folder MKFILES := $(patsubst $(CURRENT_DIR)/%,./%, $(MKFILES)) - #! Set the root project directory, if not yet set (ROOTDIR is necessary for complex projects) ROOTDIR ?= ./ @@ -29,7 +29,7 @@ help #! Displays list of included makefiles, with any targets that are documente help: @for i in $(MKFILES) ; do \ printf "\n"$(IO_CYAN)"$$i"$(IO_RESET)"\n" ; \ - awk -f "$(ROOTDIR)$(MKFILES_DIR)utils/help-targets.awk" $$i | expand -t $(COLUMN_DOC) ; \ + awk -f "$(ROOTDIR)$(MKFILES_DIR)utils/help-targets.awk" "$$i" | expand -t $(COLUMN_DOC) ; \ done @@ -39,11 +39,11 @@ help-all #! Displays all makefiles, variables and targets, with any available do help-all: @for i in $(MKFILES) ; do \ printf "\n"$(IO_CYAN)"$$i"$(IO_RESET)"\n" ; \ - awk -v color=$(IO_DARK) -v reset=$(IO_RESET) -f "$(ROOTDIR)$(MKFILES_DIR)utils/help-makefiles.awk" $$i | expand -t $(COLUMN_DOC) ; \ + awk -v color=$(IO_DARK) -v reset=$(IO_RESET) -f "$(ROOTDIR)$(MKFILES_DIR)utils/help-makefiles.awk" "$$i" | expand -t $(COLUMN_DOC) ; \ printf $(IO_DARK)"# Documented variables:"$(IO_RESET)"\n" ; \ - awk -v color=$(IO_DARK) -v reset=$(IO_RESET) -f "$(ROOTDIR)$(MKFILES_DIR)utils/help-variables.awk" $$i | expand -t $(COLUMN_DOC) ; \ + awk -v color=$(IO_DARK) -v reset=$(IO_RESET) -f "$(ROOTDIR)$(MKFILES_DIR)utils/help-variables.awk" "$$i" | expand -t $(COLUMN_DOC) ; \ printf $(IO_DARK)"# Documented targets:"$(IO_RESET)"\n" ; \ - awk -v color=$(IO_DARK) -v reset=$(IO_RESET) -f "$(ROOTDIR)$(MKFILES_DIR)utils/help-targets.awk" $$i | expand -t $(COLUMN_DOC) ; \ + awk -v color=$(IO_DARK) -v reset=$(IO_RESET) -f "$(ROOTDIR)$(MKFILES_DIR)utils/help-targets.awk" "$$i" | expand -t $(COLUMN_DOC) ; \ done @@ -52,21 +52,21 @@ help-all: help-makefiles #! Displays list of all makefiles (with brief description, if available) help-makefiles: @for i in $(MKFILES) ; do \ - printf "$$i""\t" | expand -t $(COLUMN_DOC) ; awk -f "$(ROOTDIR)$(MKFILES_DIR)utils/help-makefiles.awk" $$i | head -1 ; \ + printf "$$i""\t" | expand -t $(COLUMN_DOC) ; awk -f "$(ROOTDIR)$(MKFILES_DIR)utils/help-makefiles.awk" "$$i" | head -1 ; \ done .PHONY:\ help-variables #! Displays list of makefile variables (with brief description, if available) help-variables: @for i in $(MKFILES) ; do \ - awk -f "$(ROOTDIR)$(MKFILES_DIR)utils/help-variables.awk" $$i | expand -t $(COLUMN_DOC) ; \ + awk -f "$(ROOTDIR)$(MKFILES_DIR)utils/help-variables.awk" "$$i" | expand -t $(COLUMN_DOC) ; \ done .PHONY:\ help-targets #! Displays list of ".PHONY" targets (with brief description, if available) help-targets: @for i in $(MKFILES) ; do \ - awk -f "$(ROOTDIR)$(MKFILES_DIR)utils/help-targets.awk" $$i | expand -t $(COLUMN_DOC) ; \ + awk -f "$(ROOTDIR)$(MKFILES_DIR)utils/help-targets.awk" "$$i" | expand -t $(COLUMN_DOC) ; \ done @@ -80,7 +80,7 @@ help-debug #! Displays useful debugging info for each makefile help-debug: @for i in $(MKFILES) ; do \ printf "\n"$(IO_CYAN)"$$i"$(IO_RESET)"\n" ; \ - awk -f "$(ROOTDIR)$(MKFILES_DIR)utils/help-debug.awk" $$i ; \ + awk -f "$(ROOTDIR)$(MKFILES_DIR)utils/help-debug.awk" "$$i" ; \ done From 69cac6f663136cd3fef3e612716c6c66ac5bb81b Mon Sep 17 00:00:00 2001 From: Alexis Duquesne Date: Tue, 1 Oct 2024 08:12:07 +0000 Subject: [PATCH 7/8] fix,wip(libccc/sys/time): attempt to solve newer mingw MSYS2 warning for deprecated 'timezone' variable --- hdr/hedley.h | 2042 +++++++++++++++++++++++++++++++++++++++++++ src/sys/time/time.c | 4 + 2 files changed, 2046 insertions(+) create mode 100755 hdr/hedley.h diff --git a/hdr/hedley.h b/hdr/hedley.h new file mode 100755 index 00000000..8a713e67 --- /dev/null +++ b/hdr/hedley.h @@ -0,0 +1,2042 @@ +/* Hedley - https://nemequ.github.io/hedley + * Created by Evan Nemerson + * + * To the extent possible under law, the author(s) have dedicated all + * copyright and related and neighboring rights to this software to + * the public domain worldwide. This software is distributed without + * any warranty. + * + * For details, see . + * SPDX-License-Identifier: CC0-1.0 + */ + +#if !defined(HEDLEY_VERSION) || (HEDLEY_VERSION < 15) +#if defined(HEDLEY_VERSION) +# undef HEDLEY_VERSION +#endif +#define HEDLEY_VERSION 15 + +#if defined(HEDLEY_STRINGIFY_EX) +# undef HEDLEY_STRINGIFY_EX +#endif +#define HEDLEY_STRINGIFY_EX(x) #x + +#if defined(HEDLEY_STRINGIFY) +# undef HEDLEY_STRINGIFY +#endif +#define HEDLEY_STRINGIFY(x) HEDLEY_STRINGIFY_EX(x) + +#if defined(HEDLEY_CONCAT_EX) +# undef HEDLEY_CONCAT_EX +#endif +#define HEDLEY_CONCAT_EX(a,b) a##b + +#if defined(HEDLEY_CONCAT) +# undef HEDLEY_CONCAT +#endif +#define HEDLEY_CONCAT(a,b) HEDLEY_CONCAT_EX(a,b) + +#if defined(HEDLEY_CONCAT3_EX) +# undef HEDLEY_CONCAT3_EX +#endif +#define HEDLEY_CONCAT3_EX(a,b,c) a##b##c + +#if defined(HEDLEY_CONCAT3) +# undef HEDLEY_CONCAT3 +#endif +#define HEDLEY_CONCAT3(a,b,c) HEDLEY_CONCAT3_EX(a,b,c) + +#if defined(HEDLEY_VERSION_ENCODE) +# undef HEDLEY_VERSION_ENCODE +#endif +#define HEDLEY_VERSION_ENCODE(major,minor,revision) (((major) * 1000000) + ((minor) * 1000) + (revision)) + +#if defined(HEDLEY_VERSION_DECODE_MAJOR) +# undef HEDLEY_VERSION_DECODE_MAJOR +#endif +#define HEDLEY_VERSION_DECODE_MAJOR(version) ((version) / 1000000) + +#if defined(HEDLEY_VERSION_DECODE_MINOR) +# undef HEDLEY_VERSION_DECODE_MINOR +#endif +#define HEDLEY_VERSION_DECODE_MINOR(version) (((version) % 1000000) / 1000) + +#if defined(HEDLEY_VERSION_DECODE_REVISION) +# undef HEDLEY_VERSION_DECODE_REVISION +#endif +#define HEDLEY_VERSION_DECODE_REVISION(version) ((version) % 1000) + +#if defined(HEDLEY_GNUC_VERSION) +# undef HEDLEY_GNUC_VERSION +#endif +#if defined(__GNUC__) && defined(__GNUC_PATCHLEVEL__) +# define HEDLEY_GNUC_VERSION HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) +#elif defined(__GNUC__) +# define HEDLEY_GNUC_VERSION HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, 0) +#endif + +#if defined(HEDLEY_GNUC_VERSION_CHECK) +# undef HEDLEY_GNUC_VERSION_CHECK +#endif +#if defined(HEDLEY_GNUC_VERSION) +# define HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (HEDLEY_GNUC_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else +# define HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(HEDLEY_MSVC_VERSION) +# undef HEDLEY_MSVC_VERSION +#endif +#if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 140000000) && !defined(__ICL) +# define HEDLEY_MSVC_VERSION HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 10000000, (_MSC_FULL_VER % 10000000) / 100000, (_MSC_FULL_VER % 100000) / 100) +#elif defined(_MSC_FULL_VER) && !defined(__ICL) +# define HEDLEY_MSVC_VERSION HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 1000000, (_MSC_FULL_VER % 1000000) / 10000, (_MSC_FULL_VER % 10000) / 10) +#elif defined(_MSC_VER) && !defined(__ICL) +# define HEDLEY_MSVC_VERSION HEDLEY_VERSION_ENCODE(_MSC_VER / 100, _MSC_VER % 100, 0) +#endif + +#if defined(HEDLEY_MSVC_VERSION_CHECK) +# undef HEDLEY_MSVC_VERSION_CHECK +#endif +#if !defined(HEDLEY_MSVC_VERSION) +# define HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (0) +#elif defined(_MSC_VER) && (_MSC_VER >= 1400) +# define HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 10000000) + (minor * 100000) + (patch))) +#elif defined(_MSC_VER) && (_MSC_VER >= 1200) +# define HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 1000000) + (minor * 10000) + (patch))) +#else +# define HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_VER >= ((major * 100) + (minor))) +#endif + +#if defined(HEDLEY_INTEL_VERSION) +# undef HEDLEY_INTEL_VERSION +#endif +#if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && !defined(__ICL) +# define HEDLEY_INTEL_VERSION HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, __INTEL_COMPILER_UPDATE) +#elif defined(__INTEL_COMPILER) && !defined(__ICL) +# define HEDLEY_INTEL_VERSION HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, 0) +#endif + +#if defined(HEDLEY_INTEL_VERSION_CHECK) +# undef HEDLEY_INTEL_VERSION_CHECK +#endif +#if defined(HEDLEY_INTEL_VERSION) +# define HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (HEDLEY_INTEL_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else +# define HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(HEDLEY_INTEL_CL_VERSION) +# undef HEDLEY_INTEL_CL_VERSION +#endif +#if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && defined(__ICL) +# define HEDLEY_INTEL_CL_VERSION HEDLEY_VERSION_ENCODE(__INTEL_COMPILER, __INTEL_COMPILER_UPDATE, 0) +#endif + +#if defined(HEDLEY_INTEL_CL_VERSION_CHECK) +# undef HEDLEY_INTEL_CL_VERSION_CHECK +#endif +#if defined(HEDLEY_INTEL_CL_VERSION) +# define HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (HEDLEY_INTEL_CL_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else +# define HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(HEDLEY_PGI_VERSION) +# undef HEDLEY_PGI_VERSION +#endif +#if defined(__PGI) && defined(__PGIC__) && defined(__PGIC_MINOR__) && defined(__PGIC_PATCHLEVEL__) +# define HEDLEY_PGI_VERSION HEDLEY_VERSION_ENCODE(__PGIC__, __PGIC_MINOR__, __PGIC_PATCHLEVEL__) +#endif + +#if defined(HEDLEY_PGI_VERSION_CHECK) +# undef HEDLEY_PGI_VERSION_CHECK +#endif +#if defined(HEDLEY_PGI_VERSION) +# define HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (HEDLEY_PGI_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else +# define HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(HEDLEY_SUNPRO_VERSION) +# undef HEDLEY_SUNPRO_VERSION +#endif +#if defined(__SUNPRO_C) && (__SUNPRO_C > 0x1000) +# define HEDLEY_SUNPRO_VERSION HEDLEY_VERSION_ENCODE((((__SUNPRO_C >> 16) & 0xf) * 10) + ((__SUNPRO_C >> 12) & 0xf), (((__SUNPRO_C >> 8) & 0xf) * 10) + ((__SUNPRO_C >> 4) & 0xf), (__SUNPRO_C & 0xf) * 10) +#elif defined(__SUNPRO_C) +# define HEDLEY_SUNPRO_VERSION HEDLEY_VERSION_ENCODE((__SUNPRO_C >> 8) & 0xf, (__SUNPRO_C >> 4) & 0xf, (__SUNPRO_C) & 0xf) +#elif defined(__SUNPRO_CC) && (__SUNPRO_CC > 0x1000) +# define HEDLEY_SUNPRO_VERSION HEDLEY_VERSION_ENCODE((((__SUNPRO_CC >> 16) & 0xf) * 10) + ((__SUNPRO_CC >> 12) & 0xf), (((__SUNPRO_CC >> 8) & 0xf) * 10) + ((__SUNPRO_CC >> 4) & 0xf), (__SUNPRO_CC & 0xf) * 10) +#elif defined(__SUNPRO_CC) +# define HEDLEY_SUNPRO_VERSION HEDLEY_VERSION_ENCODE((__SUNPRO_CC >> 8) & 0xf, (__SUNPRO_CC >> 4) & 0xf, (__SUNPRO_CC) & 0xf) +#endif + +#if defined(HEDLEY_SUNPRO_VERSION_CHECK) +# undef HEDLEY_SUNPRO_VERSION_CHECK +#endif +#if defined(HEDLEY_SUNPRO_VERSION) +# define HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (HEDLEY_SUNPRO_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else +# define HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(HEDLEY_EMSCRIPTEN_VERSION) +# undef HEDLEY_EMSCRIPTEN_VERSION +#endif +#if defined(__EMSCRIPTEN__) +# define HEDLEY_EMSCRIPTEN_VERSION HEDLEY_VERSION_ENCODE(__EMSCRIPTEN_major__, __EMSCRIPTEN_minor__, __EMSCRIPTEN_tiny__) +#endif + +#if defined(HEDLEY_EMSCRIPTEN_VERSION_CHECK) +# undef HEDLEY_EMSCRIPTEN_VERSION_CHECK +#endif +#if defined(HEDLEY_EMSCRIPTEN_VERSION) +# define HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (HEDLEY_EMSCRIPTEN_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else +# define HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(HEDLEY_ARM_VERSION) +# undef HEDLEY_ARM_VERSION +#endif +#if defined(__CC_ARM) && defined(__ARMCOMPILER_VERSION) +# define HEDLEY_ARM_VERSION HEDLEY_VERSION_ENCODE(__ARMCOMPILER_VERSION / 1000000, (__ARMCOMPILER_VERSION % 1000000) / 10000, (__ARMCOMPILER_VERSION % 10000) / 100) +#elif defined(__CC_ARM) && defined(__ARMCC_VERSION) +# define HEDLEY_ARM_VERSION HEDLEY_VERSION_ENCODE(__ARMCC_VERSION / 1000000, (__ARMCC_VERSION % 1000000) / 10000, (__ARMCC_VERSION % 10000) / 100) +#endif + +#if defined(HEDLEY_ARM_VERSION_CHECK) +# undef HEDLEY_ARM_VERSION_CHECK +#endif +#if defined(HEDLEY_ARM_VERSION) +# define HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (HEDLEY_ARM_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else +# define HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(HEDLEY_IBM_VERSION) +# undef HEDLEY_IBM_VERSION +#endif +#if defined(__ibmxl__) +# define HEDLEY_IBM_VERSION HEDLEY_VERSION_ENCODE(__ibmxl_version__, __ibmxl_release__, __ibmxl_modification__) +#elif defined(__xlC__) && defined(__xlC_ver__) +# define HEDLEY_IBM_VERSION HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, (__xlC_ver__ >> 8) & 0xff) +#elif defined(__xlC__) +# define HEDLEY_IBM_VERSION HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, 0) +#endif + +#if defined(HEDLEY_IBM_VERSION_CHECK) +# undef HEDLEY_IBM_VERSION_CHECK +#endif +#if defined(HEDLEY_IBM_VERSION) +# define HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (HEDLEY_IBM_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else +# define HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(HEDLEY_TI_VERSION) +# undef HEDLEY_TI_VERSION +#endif +#if \ + defined(__TI_COMPILER_VERSION__) && \ + ( \ + defined(__TMS470__) || defined(__TI_ARM__) || \ + defined(__MSP430__) || \ + defined(__TMS320C2000__) \ + ) +# if (__TI_COMPILER_VERSION__ >= 16000000) +# define HEDLEY_TI_VERSION HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +# endif +#endif + +#if defined(HEDLEY_TI_VERSION_CHECK) +# undef HEDLEY_TI_VERSION_CHECK +#endif +#if defined(HEDLEY_TI_VERSION) +# define HEDLEY_TI_VERSION_CHECK(major,minor,patch) (HEDLEY_TI_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else +# define HEDLEY_TI_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(HEDLEY_TI_CL2000_VERSION) +# undef HEDLEY_TI_CL2000_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C2000__) +# define HEDLEY_TI_CL2000_VERSION HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(HEDLEY_TI_CL2000_VERSION_CHECK) +# undef HEDLEY_TI_CL2000_VERSION_CHECK +#endif +#if defined(HEDLEY_TI_CL2000_VERSION) +# define HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (HEDLEY_TI_CL2000_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else +# define HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(HEDLEY_TI_CL430_VERSION) +# undef HEDLEY_TI_CL430_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__MSP430__) +# define HEDLEY_TI_CL430_VERSION HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(HEDLEY_TI_CL430_VERSION_CHECK) +# undef HEDLEY_TI_CL430_VERSION_CHECK +#endif +#if defined(HEDLEY_TI_CL430_VERSION) +# define HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (HEDLEY_TI_CL430_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else +# define HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(HEDLEY_TI_ARMCL_VERSION) +# undef HEDLEY_TI_ARMCL_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && (defined(__TMS470__) || defined(__TI_ARM__)) +# define HEDLEY_TI_ARMCL_VERSION HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(HEDLEY_TI_ARMCL_VERSION_CHECK) +# undef HEDLEY_TI_ARMCL_VERSION_CHECK +#endif +#if defined(HEDLEY_TI_ARMCL_VERSION) +# define HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (HEDLEY_TI_ARMCL_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else +# define HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(HEDLEY_TI_CL6X_VERSION) +# undef HEDLEY_TI_CL6X_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C6X__) +# define HEDLEY_TI_CL6X_VERSION HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(HEDLEY_TI_CL6X_VERSION_CHECK) +# undef HEDLEY_TI_CL6X_VERSION_CHECK +#endif +#if defined(HEDLEY_TI_CL6X_VERSION) +# define HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (HEDLEY_TI_CL6X_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else +# define HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(HEDLEY_TI_CL7X_VERSION) +# undef HEDLEY_TI_CL7X_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__C7000__) +# define HEDLEY_TI_CL7X_VERSION HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(HEDLEY_TI_CL7X_VERSION_CHECK) +# undef HEDLEY_TI_CL7X_VERSION_CHECK +#endif +#if defined(HEDLEY_TI_CL7X_VERSION) +# define HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (HEDLEY_TI_CL7X_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else +# define HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(HEDLEY_TI_CLPRU_VERSION) +# undef HEDLEY_TI_CLPRU_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__PRU__) +# define HEDLEY_TI_CLPRU_VERSION HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(HEDLEY_TI_CLPRU_VERSION_CHECK) +# undef HEDLEY_TI_CLPRU_VERSION_CHECK +#endif +#if defined(HEDLEY_TI_CLPRU_VERSION) +# define HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (HEDLEY_TI_CLPRU_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else +# define HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(HEDLEY_CRAY_VERSION) +# undef HEDLEY_CRAY_VERSION +#endif +#if defined(_CRAYC) +# if defined(_RELEASE_PATCHLEVEL) +# define HEDLEY_CRAY_VERSION HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, _RELEASE_PATCHLEVEL) +# else +# define HEDLEY_CRAY_VERSION HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, 0) +# endif +#endif + +#if defined(HEDLEY_CRAY_VERSION_CHECK) +# undef HEDLEY_CRAY_VERSION_CHECK +#endif +#if defined(HEDLEY_CRAY_VERSION) +# define HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (HEDLEY_CRAY_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else +# define HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(HEDLEY_IAR_VERSION) +# undef HEDLEY_IAR_VERSION +#endif +#if defined(__IAR_SYSTEMS_ICC__) +# if __VER__ > 1000 +# define HEDLEY_IAR_VERSION HEDLEY_VERSION_ENCODE((__VER__ / 1000000), ((__VER__ / 1000) % 1000), (__VER__ % 1000)) +# else +# define HEDLEY_IAR_VERSION HEDLEY_VERSION_ENCODE(__VER__ / 100, __VER__ % 100, 0) +# endif +#endif + +#if defined(HEDLEY_IAR_VERSION_CHECK) +# undef HEDLEY_IAR_VERSION_CHECK +#endif +#if defined(HEDLEY_IAR_VERSION) +# define HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (HEDLEY_IAR_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else +# define HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(HEDLEY_TINYC_VERSION) +# undef HEDLEY_TINYC_VERSION +#endif +#if defined(__TINYC__) +# define HEDLEY_TINYC_VERSION HEDLEY_VERSION_ENCODE(__TINYC__ / 1000, (__TINYC__ / 100) % 10, __TINYC__ % 100) +#endif + +#if defined(HEDLEY_TINYC_VERSION_CHECK) +# undef HEDLEY_TINYC_VERSION_CHECK +#endif +#if defined(HEDLEY_TINYC_VERSION) +# define HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (HEDLEY_TINYC_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else +# define HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(HEDLEY_DMC_VERSION) +# undef HEDLEY_DMC_VERSION +#endif +#if defined(__DMC__) +# define HEDLEY_DMC_VERSION HEDLEY_VERSION_ENCODE(__DMC__ >> 8, (__DMC__ >> 4) & 0xf, __DMC__ & 0xf) +#endif + +#if defined(HEDLEY_DMC_VERSION_CHECK) +# undef HEDLEY_DMC_VERSION_CHECK +#endif +#if defined(HEDLEY_DMC_VERSION) +# define HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (HEDLEY_DMC_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else +# define HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(HEDLEY_COMPCERT_VERSION) +# undef HEDLEY_COMPCERT_VERSION +#endif +#if defined(__COMPCERT_VERSION__) +# define HEDLEY_COMPCERT_VERSION HEDLEY_VERSION_ENCODE(__COMPCERT_VERSION__ / 10000, (__COMPCERT_VERSION__ / 100) % 100, __COMPCERT_VERSION__ % 100) +#endif + +#if defined(HEDLEY_COMPCERT_VERSION_CHECK) +# undef HEDLEY_COMPCERT_VERSION_CHECK +#endif +#if defined(HEDLEY_COMPCERT_VERSION) +# define HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (HEDLEY_COMPCERT_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else +# define HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(HEDLEY_PELLES_VERSION) +# undef HEDLEY_PELLES_VERSION +#endif +#if defined(__POCC__) +# define HEDLEY_PELLES_VERSION HEDLEY_VERSION_ENCODE(__POCC__ / 100, __POCC__ % 100, 0) +#endif + +#if defined(HEDLEY_PELLES_VERSION_CHECK) +# undef HEDLEY_PELLES_VERSION_CHECK +#endif +#if defined(HEDLEY_PELLES_VERSION) +# define HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (HEDLEY_PELLES_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else +# define HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(HEDLEY_MCST_LCC_VERSION) +# undef HEDLEY_MCST_LCC_VERSION +#endif +#if defined(__LCC__) && defined(__LCC_MINOR__) +# define HEDLEY_MCST_LCC_VERSION HEDLEY_VERSION_ENCODE(__LCC__ / 100, __LCC__ % 100, __LCC_MINOR__) +#endif + +#if defined(HEDLEY_MCST_LCC_VERSION_CHECK) +# undef HEDLEY_MCST_LCC_VERSION_CHECK +#endif +#if defined(HEDLEY_MCST_LCC_VERSION) +# define HEDLEY_MCST_LCC_VERSION_CHECK(major,minor,patch) (HEDLEY_MCST_LCC_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else +# define HEDLEY_MCST_LCC_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(HEDLEY_GCC_VERSION) +# undef HEDLEY_GCC_VERSION +#endif +#if \ + defined(HEDLEY_GNUC_VERSION) && \ + !defined(__clang__) && \ + !defined(HEDLEY_INTEL_VERSION) && \ + !defined(HEDLEY_PGI_VERSION) && \ + !defined(HEDLEY_ARM_VERSION) && \ + !defined(HEDLEY_CRAY_VERSION) && \ + !defined(HEDLEY_TI_VERSION) && \ + !defined(HEDLEY_TI_ARMCL_VERSION) && \ + !defined(HEDLEY_TI_CL430_VERSION) && \ + !defined(HEDLEY_TI_CL2000_VERSION) && \ + !defined(HEDLEY_TI_CL6X_VERSION) && \ + !defined(HEDLEY_TI_CL7X_VERSION) && \ + !defined(HEDLEY_TI_CLPRU_VERSION) && \ + !defined(__COMPCERT__) && \ + !defined(HEDLEY_MCST_LCC_VERSION) +# define HEDLEY_GCC_VERSION HEDLEY_GNUC_VERSION +#endif + +#if defined(HEDLEY_GCC_VERSION_CHECK) +# undef HEDLEY_GCC_VERSION_CHECK +#endif +#if defined(HEDLEY_GCC_VERSION) +# define HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (HEDLEY_GCC_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else +# define HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(HEDLEY_HAS_ATTRIBUTE) +# undef HEDLEY_HAS_ATTRIBUTE +#endif +#if \ + defined(__has_attribute) && \ + ( \ + (!defined(HEDLEY_IAR_VERSION) || HEDLEY_IAR_VERSION_CHECK(8,5,9)) \ + ) +# define HEDLEY_HAS_ATTRIBUTE(attribute) __has_attribute(attribute) +#else +# define HEDLEY_HAS_ATTRIBUTE(attribute) (0) +#endif + +#if defined(HEDLEY_GNUC_HAS_ATTRIBUTE) +# undef HEDLEY_GNUC_HAS_ATTRIBUTE +#endif +#if defined(__has_attribute) +# define HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) HEDLEY_HAS_ATTRIBUTE(attribute) +#else +# define HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(HEDLEY_GCC_HAS_ATTRIBUTE) +# undef HEDLEY_GCC_HAS_ATTRIBUTE +#endif +#if defined(__has_attribute) +# define HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) HEDLEY_HAS_ATTRIBUTE(attribute) +#else +# define HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(HEDLEY_HAS_CPP_ATTRIBUTE) +# undef HEDLEY_HAS_CPP_ATTRIBUTE +#endif +#if \ + defined(__has_cpp_attribute) && \ + defined(__cplusplus) && \ + (!defined(HEDLEY_SUNPRO_VERSION) || HEDLEY_SUNPRO_VERSION_CHECK(5,15,0)) +# define HEDLEY_HAS_CPP_ATTRIBUTE(attribute) __has_cpp_attribute(attribute) +#else +# define HEDLEY_HAS_CPP_ATTRIBUTE(attribute) (0) +#endif + +#if defined(HEDLEY_HAS_CPP_ATTRIBUTE_NS) +# undef HEDLEY_HAS_CPP_ATTRIBUTE_NS +#endif +#if !defined(__cplusplus) || !defined(__has_cpp_attribute) +# define HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0) +#elif \ + !defined(HEDLEY_PGI_VERSION) && \ + !defined(HEDLEY_IAR_VERSION) && \ + (!defined(HEDLEY_SUNPRO_VERSION) || HEDLEY_SUNPRO_VERSION_CHECK(5,15,0)) && \ + (!defined(HEDLEY_MSVC_VERSION) || HEDLEY_MSVC_VERSION_CHECK(19,20,0)) +# define HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) HEDLEY_HAS_CPP_ATTRIBUTE(ns::attribute) +#else +# define HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0) +#endif + +#if defined(HEDLEY_GNUC_HAS_CPP_ATTRIBUTE) +# undef HEDLEY_GNUC_HAS_CPP_ATTRIBUTE +#endif +#if defined(__has_cpp_attribute) && defined(__cplusplus) +# define HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute) +#else +# define HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(HEDLEY_GCC_HAS_CPP_ATTRIBUTE) +# undef HEDLEY_GCC_HAS_CPP_ATTRIBUTE +#endif +#if defined(__has_cpp_attribute) && defined(__cplusplus) +# define HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute) +#else +# define HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(HEDLEY_HAS_BUILTIN) +# undef HEDLEY_HAS_BUILTIN +#endif +#if defined(__has_builtin) +# define HEDLEY_HAS_BUILTIN(builtin) __has_builtin(builtin) +#else +# define HEDLEY_HAS_BUILTIN(builtin) (0) +#endif + +#if defined(HEDLEY_GNUC_HAS_BUILTIN) +# undef HEDLEY_GNUC_HAS_BUILTIN +#endif +#if defined(__has_builtin) +# define HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin) +#else +# define HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(HEDLEY_GCC_HAS_BUILTIN) +# undef HEDLEY_GCC_HAS_BUILTIN +#endif +#if defined(__has_builtin) +# define HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin) +#else +# define HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(HEDLEY_HAS_FEATURE) +# undef HEDLEY_HAS_FEATURE +#endif +#if defined(__has_feature) +# define HEDLEY_HAS_FEATURE(feature) __has_feature(feature) +#else +# define HEDLEY_HAS_FEATURE(feature) (0) +#endif + +#if defined(HEDLEY_GNUC_HAS_FEATURE) +# undef HEDLEY_GNUC_HAS_FEATURE +#endif +#if defined(__has_feature) +# define HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature) +#else +# define HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(HEDLEY_GCC_HAS_FEATURE) +# undef HEDLEY_GCC_HAS_FEATURE +#endif +#if defined(__has_feature) +# define HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature) +#else +# define HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(HEDLEY_HAS_EXTENSION) +# undef HEDLEY_HAS_EXTENSION +#endif +#if defined(__has_extension) +# define HEDLEY_HAS_EXTENSION(extension) __has_extension(extension) +#else +# define HEDLEY_HAS_EXTENSION(extension) (0) +#endif + +#if defined(HEDLEY_GNUC_HAS_EXTENSION) +# undef HEDLEY_GNUC_HAS_EXTENSION +#endif +#if defined(__has_extension) +# define HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension) +#else +# define HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(HEDLEY_GCC_HAS_EXTENSION) +# undef HEDLEY_GCC_HAS_EXTENSION +#endif +#if defined(__has_extension) +# define HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension) +#else +# define HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(HEDLEY_HAS_DECLSPEC_ATTRIBUTE) +# undef HEDLEY_HAS_DECLSPEC_ATTRIBUTE +#endif +#if defined(__has_declspec_attribute) +# define HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) __has_declspec_attribute(attribute) +#else +# define HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) (0) +#endif + +#if defined(HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE) +# undef HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE +#endif +#if defined(__has_declspec_attribute) +# define HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute) +#else +# define HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE) +# undef HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE +#endif +#if defined(__has_declspec_attribute) +# define HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute) +#else +# define HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(HEDLEY_HAS_WARNING) +# undef HEDLEY_HAS_WARNING +#endif +#if defined(__has_warning) +# define HEDLEY_HAS_WARNING(warning) __has_warning(warning) +#else +# define HEDLEY_HAS_WARNING(warning) (0) +#endif + +#if defined(HEDLEY_GNUC_HAS_WARNING) +# undef HEDLEY_GNUC_HAS_WARNING +#endif +#if defined(__has_warning) +# define HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning) +#else +# define HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(HEDLEY_GCC_HAS_WARNING) +# undef HEDLEY_GCC_HAS_WARNING +#endif +#if defined(__has_warning) +# define HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning) +#else +# define HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if \ + (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \ + defined(__clang__) || \ + HEDLEY_GCC_VERSION_CHECK(3,0,0) || \ + HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + HEDLEY_IAR_VERSION_CHECK(8,0,0) || \ + HEDLEY_PGI_VERSION_CHECK(18,4,0) || \ + HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \ + HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \ + HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \ + HEDLEY_TI_CL6X_VERSION_CHECK(7,0,0) || \ + HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + HEDLEY_CRAY_VERSION_CHECK(5,0,0) || \ + HEDLEY_TINYC_VERSION_CHECK(0,9,17) || \ + HEDLEY_SUNPRO_VERSION_CHECK(8,0,0) || \ + (HEDLEY_IBM_VERSION_CHECK(10,1,0) && defined(__C99_PRAGMA_OPERATOR)) +# define HEDLEY_PRAGMA(value) _Pragma(#value) +#elif HEDLEY_MSVC_VERSION_CHECK(15,0,0) +# define HEDLEY_PRAGMA(value) __pragma(value) +#else +# define HEDLEY_PRAGMA(value) +#endif + +#if defined(HEDLEY_DIAGNOSTIC_PUSH) +# undef HEDLEY_DIAGNOSTIC_PUSH +#endif +#if defined(HEDLEY_DIAGNOSTIC_POP) +# undef HEDLEY_DIAGNOSTIC_POP +#endif +#if defined(__clang__) +# define HEDLEY_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push") +# define HEDLEY_DIAGNOSTIC_POP _Pragma("clang diagnostic pop") +#elif HEDLEY_INTEL_VERSION_CHECK(13,0,0) +# define HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)") +# define HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)") +#elif HEDLEY_GCC_VERSION_CHECK(4,6,0) +# define HEDLEY_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push") +# define HEDLEY_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop") +#elif \ + HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \ + HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) +# define HEDLEY_DIAGNOSTIC_PUSH __pragma(warning(push)) +# define HEDLEY_DIAGNOSTIC_POP __pragma(warning(pop)) +#elif HEDLEY_ARM_VERSION_CHECK(5,6,0) +# define HEDLEY_DIAGNOSTIC_PUSH _Pragma("push") +# define HEDLEY_DIAGNOSTIC_POP _Pragma("pop") +#elif \ + HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + HEDLEY_TI_CL430_VERSION_CHECK(4,4,0) || \ + HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \ + HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) +# define HEDLEY_DIAGNOSTIC_PUSH _Pragma("diag_push") +# define HEDLEY_DIAGNOSTIC_POP _Pragma("diag_pop") +#elif HEDLEY_PELLES_VERSION_CHECK(2,90,0) +# define HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)") +# define HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)") +#else +# define HEDLEY_DIAGNOSTIC_PUSH +# define HEDLEY_DIAGNOSTIC_POP +#endif + +/* HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ is for + HEDLEY INTERNAL USE ONLY. API subject to change without notice. */ +#if defined(HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_) +# undef HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ +#endif +#if defined(__cplusplus) +# if HEDLEY_HAS_WARNING("-Wc++98-compat") +# if HEDLEY_HAS_WARNING("-Wc++17-extensions") +# if HEDLEY_HAS_WARNING("-Wc++1z-extensions") +# define HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ + HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ + _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \ + _Pragma("clang diagnostic ignored \"-Wc++1z-extensions\"") \ + xpr \ + HEDLEY_DIAGNOSTIC_POP +# else +# define HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ + HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ + _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \ + xpr \ + HEDLEY_DIAGNOSTIC_POP +# endif +# else +# define HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ + HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ + xpr \ + HEDLEY_DIAGNOSTIC_POP +# endif +# endif +#endif +#if !defined(HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_) +# define HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(x) x +#endif + +#if defined(HEDLEY_CONST_CAST) +# undef HEDLEY_CONST_CAST +#endif +#if defined(__cplusplus) +# define HEDLEY_CONST_CAST(T, expr) (const_cast(expr)) +#elif \ + HEDLEY_HAS_WARNING("-Wcast-qual") || \ + HEDLEY_GCC_VERSION_CHECK(4,6,0) || \ + HEDLEY_INTEL_VERSION_CHECK(13,0,0) +# define HEDLEY_CONST_CAST(T, expr) (__extension__ ({ \ + HEDLEY_DIAGNOSTIC_PUSH \ + HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL \ + ((T) (expr)); \ + HEDLEY_DIAGNOSTIC_POP \ + })) +#else +# define HEDLEY_CONST_CAST(T, expr) ((T) (expr)) +#endif + +#if defined(HEDLEY_REINTERPRET_CAST) +# undef HEDLEY_REINTERPRET_CAST +#endif +#if defined(__cplusplus) +# define HEDLEY_REINTERPRET_CAST(T, expr) (reinterpret_cast(expr)) +#else +# define HEDLEY_REINTERPRET_CAST(T, expr) ((T) (expr)) +#endif + +#if defined(HEDLEY_STATIC_CAST) +# undef HEDLEY_STATIC_CAST +#endif +#if defined(__cplusplus) +# define HEDLEY_STATIC_CAST(T, expr) (static_cast(expr)) +#else +# define HEDLEY_STATIC_CAST(T, expr) ((T) (expr)) +#endif + +#if defined(HEDLEY_CPP_CAST) +# undef HEDLEY_CPP_CAST +#endif +#if defined(__cplusplus) +# if HEDLEY_HAS_WARNING("-Wold-style-cast") +# define HEDLEY_CPP_CAST(T, expr) \ + HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wold-style-cast\"") \ + ((T) (expr)) \ + HEDLEY_DIAGNOSTIC_POP +# elif HEDLEY_IAR_VERSION_CHECK(8,3,0) +# define HEDLEY_CPP_CAST(T, expr) \ + HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("diag_suppress=Pe137") \ + HEDLEY_DIAGNOSTIC_POP +# else +# define HEDLEY_CPP_CAST(T, expr) ((T) (expr)) +# endif +#else +# define HEDLEY_CPP_CAST(T, expr) (expr) +#endif + +#if defined(HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED) +# undef HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED +#endif +#if HEDLEY_HAS_WARNING("-Wdeprecated-declarations") +# define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") +#elif HEDLEY_INTEL_VERSION_CHECK(13,0,0) +# define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warning(disable:1478 1786)") +#elif HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) +# define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:1478 1786)) +#elif HEDLEY_PGI_VERSION_CHECK(20,7,0) +# define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1216,1444,1445") +#elif HEDLEY_PGI_VERSION_CHECK(17,10,0) +# define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444") +#elif HEDLEY_GCC_VERSION_CHECK(4,3,0) +# define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") +#elif HEDLEY_MSVC_VERSION_CHECK(15,0,0) +# define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:4996)) +#elif HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444") +#elif \ + HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) +# define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1291,1718") +#elif HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && !defined(__cplusplus) +# define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,E_DEPRECATED_ATT,E_DEPRECATED_ATT_MESS)") +#elif HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && defined(__cplusplus) +# define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,symdeprecated,symdeprecated2)") +#elif HEDLEY_IAR_VERSION_CHECK(8,0,0) +# define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress=Pe1444,Pe1215") +#elif HEDLEY_PELLES_VERSION_CHECK(2,90,0) +# define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warn(disable:2241)") +#else +# define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED +#endif + +#if defined(HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS) +# undef HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS +#endif +#if HEDLEY_HAS_WARNING("-Wunknown-pragmas") +# define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("clang diagnostic ignored \"-Wunknown-pragmas\"") +#elif HEDLEY_INTEL_VERSION_CHECK(13,0,0) +# define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("warning(disable:161)") +#elif HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) +# define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:161)) +#elif HEDLEY_PGI_VERSION_CHECK(17,10,0) +# define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 1675") +#elif HEDLEY_GCC_VERSION_CHECK(4,3,0) +# define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("GCC diagnostic ignored \"-Wunknown-pragmas\"") +#elif HEDLEY_MSVC_VERSION_CHECK(15,0,0) +# define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:4068)) +#elif \ + HEDLEY_TI_VERSION_CHECK(16,9,0) || \ + HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \ + HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0) +# define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163") +#elif HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) +# define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163") +#elif HEDLEY_IAR_VERSION_CHECK(8,0,0) +# define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress=Pe161") +#elif HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 161") +#else +# define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS +#endif + +#if defined(HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES) +# undef HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES +#endif +#if HEDLEY_HAS_WARNING("-Wunknown-attributes") +# define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("clang diagnostic ignored \"-Wunknown-attributes\"") +#elif HEDLEY_GCC_VERSION_CHECK(4,6,0) +# define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") +#elif HEDLEY_INTEL_VERSION_CHECK(17,0,0) +# define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("warning(disable:1292)") +#elif HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) +# define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:1292)) +#elif HEDLEY_MSVC_VERSION_CHECK(19,0,0) +# define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:5030)) +#elif HEDLEY_PGI_VERSION_CHECK(20,7,0) +# define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097,1098") +#elif HEDLEY_PGI_VERSION_CHECK(17,10,0) +# define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097") +#elif HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus) +# define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("error_messages(off,attrskipunsup)") +#elif \ + HEDLEY_TI_VERSION_CHECK(18,1,0) || \ + HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \ + HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) +# define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1173") +#elif HEDLEY_IAR_VERSION_CHECK(8,0,0) +# define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress=Pe1097") +#elif HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097") +#else +# define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES +#endif + +#if defined(HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL) +# undef HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL +#endif +#if HEDLEY_HAS_WARNING("-Wcast-qual") +# define HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("clang diagnostic ignored \"-Wcast-qual\"") +#elif HEDLEY_INTEL_VERSION_CHECK(13,0,0) +# define HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("warning(disable:2203 2331)") +#elif HEDLEY_GCC_VERSION_CHECK(3,0,0) +# define HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("GCC diagnostic ignored \"-Wcast-qual\"") +#else +# define HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL +#endif + +#if defined(HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION) +# undef HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION +#endif +#if HEDLEY_HAS_WARNING("-Wunused-function") +# define HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("clang diagnostic ignored \"-Wunused-function\"") +#elif HEDLEY_GCC_VERSION_CHECK(3,4,0) +# define HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("GCC diagnostic ignored \"-Wunused-function\"") +#elif HEDLEY_MSVC_VERSION_CHECK(1,0,0) +# define HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION __pragma(warning(disable:4505)) +#elif HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("diag_suppress 3142") +#else +# define HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION +#endif + +#if defined(HEDLEY_DEPRECATED) +# undef HEDLEY_DEPRECATED +#endif +#if defined(HEDLEY_DEPRECATED_FOR) +# undef HEDLEY_DEPRECATED_FOR +#endif +#if \ + HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ + HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) +# define HEDLEY_DEPRECATED(since) __declspec(deprecated("Since " # since)) +# define HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated("Since " #since "; use " #replacement)) +#elif \ + (HEDLEY_HAS_EXTENSION(attribute_deprecated_with_message) && !defined(HEDLEY_IAR_VERSION)) || \ + HEDLEY_GCC_VERSION_CHECK(4,5,0) || \ + HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + HEDLEY_ARM_VERSION_CHECK(5,6,0) || \ + HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) || \ + HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + HEDLEY_TI_VERSION_CHECK(18,1,0) || \ + HEDLEY_TI_ARMCL_VERSION_CHECK(18,1,0) || \ + HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \ + HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0) || \ + HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define HEDLEY_DEPRECATED(since) __attribute__((__deprecated__("Since " #since))) +# define HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__("Since " #since "; use " #replacement))) +#elif defined(__cplusplus) && (__cplusplus >= 201402L) +# define HEDLEY_DEPRECATED(since) HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since)]]) +# define HEDLEY_DEPRECATED_FOR(since, replacement) HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since "; use " #replacement)]]) +#elif \ + HEDLEY_HAS_ATTRIBUTE(deprecated) || \ + HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ + HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \ + HEDLEY_IAR_VERSION_CHECK(8,10,0) +# define HEDLEY_DEPRECATED(since) __attribute__((__deprecated__)) +# define HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__)) +#elif \ + HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ + HEDLEY_PELLES_VERSION_CHECK(6,50,0) || \ + HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) +# define HEDLEY_DEPRECATED(since) __declspec(deprecated) +# define HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated) +#elif HEDLEY_IAR_VERSION_CHECK(8,0,0) +# define HEDLEY_DEPRECATED(since) _Pragma("deprecated") +# define HEDLEY_DEPRECATED_FOR(since, replacement) _Pragma("deprecated") +#else +# define HEDLEY_DEPRECATED(since) +# define HEDLEY_DEPRECATED_FOR(since, replacement) +#endif + +#if defined(HEDLEY_UNAVAILABLE) +# undef HEDLEY_UNAVAILABLE +#endif +#if \ + HEDLEY_HAS_ATTRIBUTE(warning) || \ + HEDLEY_GCC_VERSION_CHECK(4,3,0) || \ + HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define HEDLEY_UNAVAILABLE(available_since) __attribute__((__warning__("Not available until " #available_since))) +#else +# define HEDLEY_UNAVAILABLE(available_since) +#endif + +#if defined(HEDLEY_WARN_UNUSED_RESULT) +# undef HEDLEY_WARN_UNUSED_RESULT +#endif +#if defined(HEDLEY_WARN_UNUSED_RESULT_MSG) +# undef HEDLEY_WARN_UNUSED_RESULT_MSG +#endif +#if \ + HEDLEY_HAS_ATTRIBUTE(warn_unused_result) || \ + HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ + HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + (HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \ + HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define HEDLEY_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__)) +# define HEDLEY_WARN_UNUSED_RESULT_MSG(msg) __attribute__((__warn_unused_result__)) +#elif (HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard) >= 201907L) +# define HEDLEY_WARN_UNUSED_RESULT HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) +# define HEDLEY_WARN_UNUSED_RESULT_MSG(msg) HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard(msg)]]) +#elif HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard) +# define HEDLEY_WARN_UNUSED_RESULT HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) +# define HEDLEY_WARN_UNUSED_RESULT_MSG(msg) HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) +#elif defined(_Check_return_) /* SAL */ +# define HEDLEY_WARN_UNUSED_RESULT _Check_return_ +# define HEDLEY_WARN_UNUSED_RESULT_MSG(msg) _Check_return_ +#else +# define HEDLEY_WARN_UNUSED_RESULT +# define HEDLEY_WARN_UNUSED_RESULT_MSG(msg) +#endif + +#if defined(HEDLEY_SENTINEL) +# undef HEDLEY_SENTINEL +#endif +#if \ + HEDLEY_HAS_ATTRIBUTE(sentinel) || \ + HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ + HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + HEDLEY_ARM_VERSION_CHECK(5,4,0) || \ + HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define HEDLEY_SENTINEL(position) __attribute__((__sentinel__(position))) +#else +# define HEDLEY_SENTINEL(position) +#endif + +#if defined(HEDLEY_NO_RETURN) +# undef HEDLEY_NO_RETURN +#endif +#if HEDLEY_IAR_VERSION_CHECK(8,0,0) +# define HEDLEY_NO_RETURN __noreturn +#elif \ + HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define HEDLEY_NO_RETURN __attribute__((__noreturn__)) +#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +# define HEDLEY_NO_RETURN _Noreturn +#elif defined(__cplusplus) && (__cplusplus >= 201103L) +# define HEDLEY_NO_RETURN HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[noreturn]]) +#elif \ + HEDLEY_HAS_ATTRIBUTE(noreturn) || \ + HEDLEY_GCC_VERSION_CHECK(3,2,0) || \ + HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + HEDLEY_IAR_VERSION_CHECK(8,10,0) +# define HEDLEY_NO_RETURN __attribute__((__noreturn__)) +#elif HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) +# define HEDLEY_NO_RETURN _Pragma("does_not_return") +#elif \ + HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ + HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) +# define HEDLEY_NO_RETURN __declspec(noreturn) +#elif HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus) +# define HEDLEY_NO_RETURN _Pragma("FUNC_NEVER_RETURNS;") +#elif HEDLEY_COMPCERT_VERSION_CHECK(3,2,0) +# define HEDLEY_NO_RETURN __attribute((noreturn)) +#elif HEDLEY_PELLES_VERSION_CHECK(9,0,0) +# define HEDLEY_NO_RETURN __declspec(noreturn) +#else +# define HEDLEY_NO_RETURN +#endif + +#if defined(HEDLEY_NO_ESCAPE) +# undef HEDLEY_NO_ESCAPE +#endif +#if HEDLEY_HAS_ATTRIBUTE(noescape) +# define HEDLEY_NO_ESCAPE __attribute__((__noescape__)) +#else +# define HEDLEY_NO_ESCAPE +#endif + +#if defined(HEDLEY_UNREACHABLE) +# undef HEDLEY_UNREACHABLE +#endif +#if defined(HEDLEY_UNREACHABLE_RETURN) +# undef HEDLEY_UNREACHABLE_RETURN +#endif +#if defined(HEDLEY_ASSUME) +# undef HEDLEY_ASSUME +#endif +#if \ + HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ + HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) +# define HEDLEY_ASSUME(expr) __assume(expr) +#elif HEDLEY_HAS_BUILTIN(__builtin_assume) +# define HEDLEY_ASSUME(expr) __builtin_assume(expr) +#elif \ + HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ + HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) +# if defined(__cplusplus) +# define HEDLEY_ASSUME(expr) std::_nassert(expr) +# else +# define HEDLEY_ASSUME(expr) _nassert(expr) +# endif +#endif +#if \ + (HEDLEY_HAS_BUILTIN(__builtin_unreachable) && (!defined(HEDLEY_ARM_VERSION))) || \ + HEDLEY_GCC_VERSION_CHECK(4,5,0) || \ + HEDLEY_PGI_VERSION_CHECK(18,10,0) || \ + HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + HEDLEY_IBM_VERSION_CHECK(13,1,5) || \ + HEDLEY_CRAY_VERSION_CHECK(10,0,0) || \ + HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define HEDLEY_UNREACHABLE() __builtin_unreachable() +#elif defined(HEDLEY_ASSUME) +# define HEDLEY_UNREACHABLE() HEDLEY_ASSUME(0) +#endif +#if !defined(HEDLEY_ASSUME) +# if defined(HEDLEY_UNREACHABLE) +# define HEDLEY_ASSUME(expr) HEDLEY_STATIC_CAST(void, ((expr) ? 1 : (HEDLEY_UNREACHABLE(), 1))) +# else +# define HEDLEY_ASSUME(expr) HEDLEY_STATIC_CAST(void, expr) +# endif +#endif +#if defined(HEDLEY_UNREACHABLE) +# if \ + HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ + HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) +# define HEDLEY_UNREACHABLE_RETURN(value) return (HEDLEY_STATIC_CAST(void, HEDLEY_ASSUME(0)), (value)) +# else +# define HEDLEY_UNREACHABLE_RETURN(value) HEDLEY_UNREACHABLE() +# endif +#else +# define HEDLEY_UNREACHABLE_RETURN(value) return (value) +#endif +#if !defined(HEDLEY_UNREACHABLE) +# define HEDLEY_UNREACHABLE() HEDLEY_ASSUME(0) +#endif + +HEDLEY_DIAGNOSTIC_PUSH +#if HEDLEY_HAS_WARNING("-Wpedantic") +# pragma clang diagnostic ignored "-Wpedantic" +#endif +#if HEDLEY_HAS_WARNING("-Wc++98-compat-pedantic") && defined(__cplusplus) +# pragma clang diagnostic ignored "-Wc++98-compat-pedantic" +#endif +#if HEDLEY_GCC_HAS_WARNING("-Wvariadic-macros",4,0,0) +# if defined(__clang__) +# pragma clang diagnostic ignored "-Wvariadic-macros" +# elif defined(HEDLEY_GCC_VERSION) +# pragma GCC diagnostic ignored "-Wvariadic-macros" +# endif +#endif +#if defined(HEDLEY_NON_NULL) +# undef HEDLEY_NON_NULL +#endif +#if \ + HEDLEY_HAS_ATTRIBUTE(nonnull) || \ + HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ + HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + HEDLEY_ARM_VERSION_CHECK(4,1,0) +# define HEDLEY_NON_NULL(...) __attribute__((__nonnull__(__VA_ARGS__))) +#else +# define HEDLEY_NON_NULL(...) +#endif +HEDLEY_DIAGNOSTIC_POP + +#if defined(HEDLEY_PRINTF_FORMAT) +# undef HEDLEY_PRINTF_FORMAT +#endif +#if defined(__MINGW32__) && HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && !defined(__USE_MINGW_ANSI_STDIO) +# define HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(ms_printf, string_idx, first_to_check))) +#elif defined(__MINGW32__) && HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && defined(__USE_MINGW_ANSI_STDIO) +# define HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(gnu_printf, string_idx, first_to_check))) +#elif \ + HEDLEY_HAS_ATTRIBUTE(format) || \ + HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ + HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + HEDLEY_ARM_VERSION_CHECK(5,6,0) || \ + HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(__printf__, string_idx, first_to_check))) +#elif HEDLEY_PELLES_VERSION_CHECK(6,0,0) +# define HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __declspec(vaformat(printf,string_idx,first_to_check)) +#else +# define HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) +#endif + +#if defined(HEDLEY_CONSTEXPR) +# undef HEDLEY_CONSTEXPR +#endif +#if defined(__cplusplus) +# if __cplusplus >= 201103L +# define HEDLEY_CONSTEXPR HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(constexpr) +# endif +#endif +#if !defined(HEDLEY_CONSTEXPR) +# define HEDLEY_CONSTEXPR +#endif + +#if defined(HEDLEY_PREDICT) +# undef HEDLEY_PREDICT +#endif +#if defined(HEDLEY_LIKELY) +# undef HEDLEY_LIKELY +#endif +#if defined(HEDLEY_UNLIKELY) +# undef HEDLEY_UNLIKELY +#endif +#if defined(HEDLEY_UNPREDICTABLE) +# undef HEDLEY_UNPREDICTABLE +#endif +#if HEDLEY_HAS_BUILTIN(__builtin_unpredictable) +# define HEDLEY_UNPREDICTABLE(expr) __builtin_unpredictable((expr)) +#endif +#if \ + (HEDLEY_HAS_BUILTIN(__builtin_expect_with_probability) && !defined(HEDLEY_PGI_VERSION)) || \ + HEDLEY_GCC_VERSION_CHECK(9,0,0) || \ + HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define HEDLEY_PREDICT(expr, value, probability) __builtin_expect_with_probability( (expr), (value), (probability)) +# define HEDLEY_PREDICT_TRUE(expr, probability) __builtin_expect_with_probability(!!(expr), 1 , (probability)) +# define HEDLEY_PREDICT_FALSE(expr, probability) __builtin_expect_with_probability(!!(expr), 0 , (probability)) +# define HEDLEY_LIKELY(expr) __builtin_expect (!!(expr), 1 ) +# define HEDLEY_UNLIKELY(expr) __builtin_expect (!!(expr), 0 ) +#elif \ + (HEDLEY_HAS_BUILTIN(__builtin_expect) && !defined(HEDLEY_INTEL_CL_VERSION)) || \ + HEDLEY_GCC_VERSION_CHECK(3,0,0) || \ + HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + (HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \ + HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \ + HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \ + HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \ + HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ + HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + HEDLEY_TINYC_VERSION_CHECK(0,9,27) || \ + HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ + HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define HEDLEY_PREDICT(expr, expected, probability) \ + (((probability) >= 0.9) ? __builtin_expect((expr), (expected)) : (HEDLEY_STATIC_CAST(void, expected), (expr))) +# define HEDLEY_PREDICT_TRUE(expr, probability) \ + (__extension__ ({ \ + double hedley_probability_ = (probability); \ + ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 1) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 0) : !!(expr))); \ + })) +# define HEDLEY_PREDICT_FALSE(expr, probability) \ + (__extension__ ({ \ + double hedley_probability_ = (probability); \ + ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 0) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 1) : !!(expr))); \ + })) +# define HEDLEY_LIKELY(expr) __builtin_expect(!!(expr), 1) +# define HEDLEY_UNLIKELY(expr) __builtin_expect(!!(expr), 0) +#else +# define HEDLEY_PREDICT(expr, expected, probability) (HEDLEY_STATIC_CAST(void, expected), (expr)) +# define HEDLEY_PREDICT_TRUE(expr, probability) (!!(expr)) +# define HEDLEY_PREDICT_FALSE(expr, probability) (!!(expr)) +# define HEDLEY_LIKELY(expr) (!!(expr)) +# define HEDLEY_UNLIKELY(expr) (!!(expr)) +#endif +#if !defined(HEDLEY_UNPREDICTABLE) +# define HEDLEY_UNPREDICTABLE(expr) HEDLEY_PREDICT(expr, 1, 0.5) +#endif + +#if defined(HEDLEY_MALLOC) +# undef HEDLEY_MALLOC +#endif +#if \ + HEDLEY_HAS_ATTRIBUTE(malloc) || \ + HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ + HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + HEDLEY_IBM_VERSION_CHECK(12,1,0) || \ + HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define HEDLEY_MALLOC __attribute__((__malloc__)) +#elif HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) +# define HEDLEY_MALLOC _Pragma("returns_new_memory") +#elif \ + HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ + HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) +# define HEDLEY_MALLOC __declspec(restrict) +#else +# define HEDLEY_MALLOC +#endif + +#if defined(HEDLEY_PURE) +# undef HEDLEY_PURE +#endif +#if \ + HEDLEY_HAS_ATTRIBUTE(pure) || \ + HEDLEY_GCC_VERSION_CHECK(2,96,0) || \ + HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define HEDLEY_PURE __attribute__((__pure__)) +#elif HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) +# define HEDLEY_PURE _Pragma("does_not_write_global_data") +#elif defined(__cplusplus) && \ + ( \ + HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \ + HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) || \ + HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) \ + ) +# define HEDLEY_PURE _Pragma("FUNC_IS_PURE;") +#else +# define HEDLEY_PURE +#endif + +#if defined(HEDLEY_CONST) +# undef HEDLEY_CONST +#endif +#if \ + HEDLEY_HAS_ATTRIBUTE(const) || \ + HEDLEY_GCC_VERSION_CHECK(2,5,0) || \ + HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define HEDLEY_CONST __attribute__((__const__)) +#elif \ + HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) +# define HEDLEY_CONST _Pragma("no_side_effect") +#else +# define HEDLEY_CONST HEDLEY_PURE +#endif + +#if defined(HEDLEY_RESTRICT) +# undef HEDLEY_RESTRICT +#endif +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && !defined(__cplusplus) +# define HEDLEY_RESTRICT restrict +#elif \ + HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ + HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ + HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ + HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + HEDLEY_TI_CL2000_VERSION_CHECK(6,2,4) || \ + HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \ + HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + (HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus)) || \ + HEDLEY_IAR_VERSION_CHECK(8,0,0) || \ + defined(__clang__) || \ + HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define HEDLEY_RESTRICT __restrict +#elif HEDLEY_SUNPRO_VERSION_CHECK(5,3,0) && !defined(__cplusplus) +# define HEDLEY_RESTRICT _Restrict +#else +# define HEDLEY_RESTRICT +#endif + +#if defined(HEDLEY_INLINE) +# undef HEDLEY_INLINE +#endif +#if \ + (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \ + (defined(__cplusplus) && (__cplusplus >= 199711L)) +# define HEDLEY_INLINE inline +#elif \ + defined(HEDLEY_GCC_VERSION) || \ + HEDLEY_ARM_VERSION_CHECK(6,2,0) +# define HEDLEY_INLINE __inline__ +#elif \ + HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \ + HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ + HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + HEDLEY_TI_ARMCL_VERSION_CHECK(5,1,0) || \ + HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \ + HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ + HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \ + HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define HEDLEY_INLINE __inline +#else +# define HEDLEY_INLINE +#endif + +#if defined(HEDLEY_ALWAYS_INLINE) +# undef HEDLEY_ALWAYS_INLINE +#endif +#if \ + HEDLEY_HAS_ATTRIBUTE(always_inline) || \ + HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ + HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \ + HEDLEY_IAR_VERSION_CHECK(8,10,0) +# define HEDLEY_ALWAYS_INLINE __attribute__((__always_inline__)) HEDLEY_INLINE +#elif \ + HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \ + HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) +# define HEDLEY_ALWAYS_INLINE __forceinline +#elif defined(__cplusplus) && \ + ( \ + HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ + HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) \ + ) +# define HEDLEY_ALWAYS_INLINE _Pragma("FUNC_ALWAYS_INLINE;") +#elif HEDLEY_IAR_VERSION_CHECK(8,0,0) +# define HEDLEY_ALWAYS_INLINE _Pragma("inline=forced") +#else +# define HEDLEY_ALWAYS_INLINE HEDLEY_INLINE +#endif + +#if defined(HEDLEY_NEVER_INLINE) +# undef HEDLEY_NEVER_INLINE +#endif +#if \ + HEDLEY_HAS_ATTRIBUTE(noinline) || \ + HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ + HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \ + HEDLEY_IAR_VERSION_CHECK(8,10,0) +# define HEDLEY_NEVER_INLINE __attribute__((__noinline__)) +#elif \ + HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ + HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) +# define HEDLEY_NEVER_INLINE __declspec(noinline) +#elif HEDLEY_PGI_VERSION_CHECK(10,2,0) +# define HEDLEY_NEVER_INLINE _Pragma("noinline") +#elif HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus) +# define HEDLEY_NEVER_INLINE _Pragma("FUNC_CANNOT_INLINE;") +#elif HEDLEY_IAR_VERSION_CHECK(8,0,0) +# define HEDLEY_NEVER_INLINE _Pragma("inline=never") +#elif HEDLEY_COMPCERT_VERSION_CHECK(3,2,0) +# define HEDLEY_NEVER_INLINE __attribute((noinline)) +#elif HEDLEY_PELLES_VERSION_CHECK(9,0,0) +# define HEDLEY_NEVER_INLINE __declspec(noinline) +#else +# define HEDLEY_NEVER_INLINE +#endif + +#if defined(HEDLEY_PRIVATE) +# undef HEDLEY_PRIVATE +#endif +#if defined(HEDLEY_PUBLIC) +# undef HEDLEY_PUBLIC +#endif +#if defined(HEDLEY_IMPORT) +# undef HEDLEY_IMPORT +#endif +#if defined(_WIN32) || defined(__CYGWIN__) +# define HEDLEY_PRIVATE +# define HEDLEY_PUBLIC __declspec(dllexport) +# define HEDLEY_IMPORT __declspec(dllimport) +#else +# if \ + HEDLEY_HAS_ATTRIBUTE(visibility) || \ + HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ + HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ + ( \ + defined(__TI_EABI__) && \ + ( \ + (HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) \ + ) \ + ) || \ + HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define HEDLEY_PRIVATE __attribute__((__visibility__("hidden"))) +# define HEDLEY_PUBLIC __attribute__((__visibility__("default"))) +# else +# define HEDLEY_PRIVATE +# define HEDLEY_PUBLIC +# endif +# define HEDLEY_IMPORT extern +#endif + +#if defined(HEDLEY_NO_THROW) +# undef HEDLEY_NO_THROW +#endif +#if \ + HEDLEY_HAS_ATTRIBUTE(nothrow) || \ + HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ + HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define HEDLEY_NO_THROW __attribute__((__nothrow__)) +#elif \ + HEDLEY_MSVC_VERSION_CHECK(13,1,0) || \ + HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ + HEDLEY_ARM_VERSION_CHECK(4,1,0) +# define HEDLEY_NO_THROW __declspec(nothrow) +#else +# define HEDLEY_NO_THROW +#endif + +#if defined(HEDLEY_FALL_THROUGH) +# undef HEDLEY_FALL_THROUGH +#endif +#if \ + HEDLEY_HAS_ATTRIBUTE(fallthrough) || \ + HEDLEY_GCC_VERSION_CHECK(7,0,0) || \ + HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define HEDLEY_FALL_THROUGH __attribute__((__fallthrough__)) +#elif HEDLEY_HAS_CPP_ATTRIBUTE_NS(clang,fallthrough) +# define HEDLEY_FALL_THROUGH HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[clang::fallthrough]]) +#elif HEDLEY_HAS_CPP_ATTRIBUTE(fallthrough) +# define HEDLEY_FALL_THROUGH HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[fallthrough]]) +#elif defined(__fallthrough) /* SAL */ +# define HEDLEY_FALL_THROUGH __fallthrough +#else +# define HEDLEY_FALL_THROUGH +#endif + +#if defined(HEDLEY_RETURNS_NON_NULL) +# undef HEDLEY_RETURNS_NON_NULL +#endif +#if \ + HEDLEY_HAS_ATTRIBUTE(returns_nonnull) || \ + HEDLEY_GCC_VERSION_CHECK(4,9,0) || \ + HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define HEDLEY_RETURNS_NON_NULL __attribute__((__returns_nonnull__)) +#elif defined(_Ret_notnull_) /* SAL */ +# define HEDLEY_RETURNS_NON_NULL _Ret_notnull_ +#else +# define HEDLEY_RETURNS_NON_NULL +#endif + +#if defined(HEDLEY_ARRAY_PARAM) +# undef HEDLEY_ARRAY_PARAM +#endif +#if \ + defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \ + !defined(__STDC_NO_VLA__) && \ + !defined(__cplusplus) && \ + !defined(HEDLEY_PGI_VERSION) && \ + !defined(HEDLEY_TINYC_VERSION) +# define HEDLEY_ARRAY_PARAM(name) (name) +#else +# define HEDLEY_ARRAY_PARAM(name) +#endif + +#if defined(HEDLEY_IS_CONSTANT) +# undef HEDLEY_IS_CONSTANT +#endif +#if defined(HEDLEY_REQUIRE_CONSTEXPR) +# undef HEDLEY_REQUIRE_CONSTEXPR +#endif +/* HEDLEY_IS_CONSTEXPR_ is for + HEDLEY INTERNAL USE ONLY. API subject to change without notice. */ +#if defined(HEDLEY_IS_CONSTEXPR_) +# undef HEDLEY_IS_CONSTEXPR_ +#endif +#if \ + HEDLEY_HAS_BUILTIN(__builtin_constant_p) || \ + HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ + HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + HEDLEY_TINYC_VERSION_CHECK(0,9,19) || \ + HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ + HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ + (HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) && !defined(__cplusplus)) || \ + HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ + HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define HEDLEY_IS_CONSTANT(expr) __builtin_constant_p(expr) +#endif +#if !defined(__cplusplus) +# if \ + HEDLEY_HAS_BUILTIN(__builtin_types_compatible_p) || \ + HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ + HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ + HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ + HEDLEY_ARM_VERSION_CHECK(5,4,0) || \ + HEDLEY_TINYC_VERSION_CHECK(0,9,24) +# if defined(__INTPTR_TYPE__) +# define HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0)), int*) +# else +# include +# define HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((intptr_t) ((expr) * 0)) : (int*) 0)), int*) +# endif +# elif \ + ( \ + defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) && \ + !defined(HEDLEY_SUNPRO_VERSION) && \ + !defined(HEDLEY_PGI_VERSION) && \ + !defined(HEDLEY_IAR_VERSION)) || \ + (HEDLEY_HAS_EXTENSION(c_generic_selections) && !defined(HEDLEY_IAR_VERSION)) || \ + HEDLEY_GCC_VERSION_CHECK(4,9,0) || \ + HEDLEY_INTEL_VERSION_CHECK(17,0,0) || \ + HEDLEY_IBM_VERSION_CHECK(12,1,0) || \ + HEDLEY_ARM_VERSION_CHECK(5,3,0) +# if defined(__INTPTR_TYPE__) +# define HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0), int*: 1, void*: 0) +# else +# include +# define HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((intptr_t) * 0) : (int*) 0), int*: 1, void*: 0) +# endif +# elif \ + defined(HEDLEY_GCC_VERSION) || \ + defined(HEDLEY_INTEL_VERSION) || \ + defined(HEDLEY_TINYC_VERSION) || \ + defined(HEDLEY_TI_ARMCL_VERSION) || \ + HEDLEY_TI_CL430_VERSION_CHECK(18,12,0) || \ + defined(HEDLEY_TI_CL2000_VERSION) || \ + defined(HEDLEY_TI_CL6X_VERSION) || \ + defined(HEDLEY_TI_CL7X_VERSION) || \ + defined(HEDLEY_TI_CLPRU_VERSION) || \ + defined(__clang__) +# define HEDLEY_IS_CONSTEXPR_(expr) ( \ + sizeof(void) != \ + sizeof(*( \ + 1 ? \ + ((void*) ((expr) * 0L) ) : \ + ((struct { char v[sizeof(void) * 2]; } *) 1) \ + ) \ + ) \ + ) +# endif +#endif +#if defined(HEDLEY_IS_CONSTEXPR_) +# if !defined(HEDLEY_IS_CONSTANT) +# define HEDLEY_IS_CONSTANT(expr) HEDLEY_IS_CONSTEXPR_(expr) +# endif +# define HEDLEY_REQUIRE_CONSTEXPR(expr) (HEDLEY_IS_CONSTEXPR_(expr) ? (expr) : (-1)) +#else +# if !defined(HEDLEY_IS_CONSTANT) +# define HEDLEY_IS_CONSTANT(expr) (0) +# endif +# define HEDLEY_REQUIRE_CONSTEXPR(expr) (expr) +#endif + +#if defined(HEDLEY_BEGIN_C_DECLS) +# undef HEDLEY_BEGIN_C_DECLS +#endif +#if defined(HEDLEY_END_C_DECLS) +# undef HEDLEY_END_C_DECLS +#endif +#if defined(HEDLEY_C_DECL) +# undef HEDLEY_C_DECL +#endif +#if defined(__cplusplus) +# define HEDLEY_BEGIN_C_DECLS extern "C" { +# define HEDLEY_END_C_DECLS } +# define HEDLEY_C_DECL extern "C" +#else +# define HEDLEY_BEGIN_C_DECLS +# define HEDLEY_END_C_DECLS +# define HEDLEY_C_DECL +#endif + +#if defined(HEDLEY_STATIC_ASSERT) +# undef HEDLEY_STATIC_ASSERT +#endif +#if \ + !defined(__cplusplus) && ( \ + (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) || \ + (HEDLEY_HAS_FEATURE(c_static_assert) && !defined(HEDLEY_INTEL_CL_VERSION)) || \ + HEDLEY_GCC_VERSION_CHECK(6,0,0) || \ + HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + defined(_Static_assert) \ + ) +# define HEDLEY_STATIC_ASSERT(expr, message) _Static_assert(expr, message) +#elif \ + (defined(__cplusplus) && (__cplusplus >= 201103L)) || \ + HEDLEY_MSVC_VERSION_CHECK(16,0,0) || \ + HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) +# define HEDLEY_STATIC_ASSERT(expr, message) HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(static_assert(expr, message)) +#else +# define HEDLEY_STATIC_ASSERT(expr, message) +#endif + +#if defined(HEDLEY_NULL) +# undef HEDLEY_NULL +#endif +#if defined(__cplusplus) +# if __cplusplus >= 201103L +# define HEDLEY_NULL HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(nullptr) +# elif defined(NULL) +# define HEDLEY_NULL NULL +# else +# define HEDLEY_NULL HEDLEY_STATIC_CAST(void*, 0) +# endif +#elif defined(NULL) +# define HEDLEY_NULL NULL +#else +# define HEDLEY_NULL ((void*) 0) +#endif + +#if defined(HEDLEY_MESSAGE) +# undef HEDLEY_MESSAGE +#endif +#if HEDLEY_HAS_WARNING("-Wunknown-pragmas") +# define HEDLEY_MESSAGE(msg) \ + HEDLEY_DIAGNOSTIC_PUSH \ + HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ + HEDLEY_PRAGMA(message msg) \ + HEDLEY_DIAGNOSTIC_POP +#elif \ + HEDLEY_GCC_VERSION_CHECK(4,4,0) || \ + HEDLEY_INTEL_VERSION_CHECK(13,0,0) +# define HEDLEY_MESSAGE(msg) HEDLEY_PRAGMA(message msg) +#elif HEDLEY_CRAY_VERSION_CHECK(5,0,0) +# define HEDLEY_MESSAGE(msg) HEDLEY_PRAGMA(_CRI message msg) +#elif HEDLEY_IAR_VERSION_CHECK(8,0,0) +# define HEDLEY_MESSAGE(msg) HEDLEY_PRAGMA(message(msg)) +#elif HEDLEY_PELLES_VERSION_CHECK(2,0,0) +# define HEDLEY_MESSAGE(msg) HEDLEY_PRAGMA(message(msg)) +#else +# define HEDLEY_MESSAGE(msg) +#endif + +#if defined(HEDLEY_WARNING) +# undef HEDLEY_WARNING +#endif +#if HEDLEY_HAS_WARNING("-Wunknown-pragmas") +# define HEDLEY_WARNING(msg) \ + HEDLEY_DIAGNOSTIC_PUSH \ + HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ + HEDLEY_PRAGMA(clang warning msg) \ + HEDLEY_DIAGNOSTIC_POP +#elif \ + HEDLEY_GCC_VERSION_CHECK(4,8,0) || \ + HEDLEY_PGI_VERSION_CHECK(18,4,0) || \ + HEDLEY_INTEL_VERSION_CHECK(13,0,0) +# define HEDLEY_WARNING(msg) HEDLEY_PRAGMA(GCC warning msg) +#elif \ + HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \ + HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) +# define HEDLEY_WARNING(msg) HEDLEY_PRAGMA(message(msg)) +#else +# define HEDLEY_WARNING(msg) HEDLEY_MESSAGE(msg) +#endif + +#if defined(HEDLEY_REQUIRE) +# undef HEDLEY_REQUIRE +#endif +#if defined(HEDLEY_REQUIRE_MSG) +# undef HEDLEY_REQUIRE_MSG +#endif +#if HEDLEY_HAS_ATTRIBUTE(diagnose_if) +# if HEDLEY_HAS_WARNING("-Wgcc-compat") +# define HEDLEY_REQUIRE(expr) \ + HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \ + __attribute__((diagnose_if(!(expr), #expr, "error"))) \ + HEDLEY_DIAGNOSTIC_POP +# define HEDLEY_REQUIRE_MSG(expr,msg) \ + HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \ + __attribute__((diagnose_if(!(expr), msg, "error"))) \ + HEDLEY_DIAGNOSTIC_POP +# else +# define HEDLEY_REQUIRE(expr) __attribute__((diagnose_if(!(expr), #expr, "error"))) +# define HEDLEY_REQUIRE_MSG(expr,msg) __attribute__((diagnose_if(!(expr), msg, "error"))) +# endif +#else +# define HEDLEY_REQUIRE(expr) +# define HEDLEY_REQUIRE_MSG(expr,msg) +#endif + +#if defined(HEDLEY_FLAGS) +# undef HEDLEY_FLAGS +#endif +#if HEDLEY_HAS_ATTRIBUTE(flag_enum) && (!defined(__cplusplus) || HEDLEY_HAS_WARNING("-Wbitfield-enum-conversion")) +# define HEDLEY_FLAGS __attribute__((__flag_enum__)) +#else +# define HEDLEY_FLAGS +#endif + +#if defined(HEDLEY_FLAGS_CAST) +# undef HEDLEY_FLAGS_CAST +#endif +#if HEDLEY_INTEL_VERSION_CHECK(19,0,0) +# define HEDLEY_FLAGS_CAST(T, expr) (__extension__ ({ \ + HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("warning(disable:188)") \ + ((T) (expr)); \ + HEDLEY_DIAGNOSTIC_POP \ + })) +#else +# define HEDLEY_FLAGS_CAST(T, expr) HEDLEY_STATIC_CAST(T, expr) +#endif + +#if defined(HEDLEY_EMPTY_BASES) +# undef HEDLEY_EMPTY_BASES +#endif +#if \ + (HEDLEY_MSVC_VERSION_CHECK(19,0,23918) && !HEDLEY_MSVC_VERSION_CHECK(20,0,0)) || \ + HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) +# define HEDLEY_EMPTY_BASES __declspec(empty_bases) +#else +# define HEDLEY_EMPTY_BASES +#endif + +/* Remaining macros are deprecated. */ + +#if defined(HEDLEY_GCC_NOT_CLANG_VERSION_CHECK) +# undef HEDLEY_GCC_NOT_CLANG_VERSION_CHECK +#endif +#if defined(__clang__) +# define HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) (0) +#else +# define HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(HEDLEY_CLANG_HAS_ATTRIBUTE) +# undef HEDLEY_CLANG_HAS_ATTRIBUTE +#endif +#define HEDLEY_CLANG_HAS_ATTRIBUTE(attribute) HEDLEY_HAS_ATTRIBUTE(attribute) + +#if defined(HEDLEY_CLANG_HAS_CPP_ATTRIBUTE) +# undef HEDLEY_CLANG_HAS_CPP_ATTRIBUTE +#endif +#define HEDLEY_CLANG_HAS_CPP_ATTRIBUTE(attribute) HEDLEY_HAS_CPP_ATTRIBUTE(attribute) + +#if defined(HEDLEY_CLANG_HAS_BUILTIN) +# undef HEDLEY_CLANG_HAS_BUILTIN +#endif +#define HEDLEY_CLANG_HAS_BUILTIN(builtin) HEDLEY_HAS_BUILTIN(builtin) + +#if defined(HEDLEY_CLANG_HAS_FEATURE) +# undef HEDLEY_CLANG_HAS_FEATURE +#endif +#define HEDLEY_CLANG_HAS_FEATURE(feature) HEDLEY_HAS_FEATURE(feature) + +#if defined(HEDLEY_CLANG_HAS_EXTENSION) +# undef HEDLEY_CLANG_HAS_EXTENSION +#endif +#define HEDLEY_CLANG_HAS_EXTENSION(extension) HEDLEY_HAS_EXTENSION(extension) + +#if defined(HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE) +# undef HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE +#endif +#define HEDLEY_CLANG_HAS_DECLSPEC_ATTRIBUTE(attribute) HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) + +#if defined(HEDLEY_CLANG_HAS_WARNING) +# undef HEDLEY_CLANG_HAS_WARNING +#endif +#define HEDLEY_CLANG_HAS_WARNING(warning) HEDLEY_HAS_WARNING(warning) + +#endif /* !defined(HEDLEY_VERSION) || (HEDLEY_VERSION < X) */ diff --git a/src/sys/time/time.c b/src/sys/time/time.c index 84171ca7..ee0efd2a 100644 --- a/src/sys/time/time.c +++ b/src/sys/time/time.c @@ -6,6 +6,7 @@ #define __STDC_WANT_LIB_EXT1__ 1 #include #else + #include "hedley.h" extern long timezone; time_t time(time_t* t); @@ -73,10 +74,13 @@ s_date Time_ToDate_LocalTime(t_time const value) if (tmp != NULL) tm = *tmp; #endif +HEDLEY_DIAGNOSTIC_PUSH +HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED result = Date_FromSTDC(&tm); if (result.offset == 0) result.offset = -(long)timezone; return (result); +HEDLEY_DIAGNOSTIC_POP } From de41bb6b7c9dab8676de2b78cdf0034d134d5eb0 Mon Sep 17 00:00:00 2001 From: Alexis Duquesne Date: Tue, 1 Oct 2024 08:14:58 +0000 Subject: [PATCH 8/8] fix,wip(libccc/sys/time): attempt to solve newer mingw MSYS2 warning for deprecated 'timezone' variable --- src/sys/time/time.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sys/time/time.c b/src/sys/time/time.c index ee0efd2a..1588fe62 100644 --- a/src/sys/time/time.c +++ b/src/sys/time/time.c @@ -1,4 +1,6 @@ +#include "hedley.h" + #include "libccc/memory.h" #include "libccc/sys/time.h" @@ -6,7 +8,6 @@ #define __STDC_WANT_LIB_EXT1__ 1 #include #else - #include "hedley.h" extern long timezone; time_t time(time_t* t);