change int.h to check MAJOR_VER < 3 when CHK_C is undefined

The int.h will trigger an error when CHK_C is undefined and MAJOR_VER
>= 3.  Improved the int.h error message in this case.

Added some comments and C integers to int.h.
This commit is contained in:
Landon Curt Noll
2023-08-23 14:53:15 -07:00
parent 0353aba275
commit 0bb66cff74
2 changed files with 11 additions and 9 deletions

View File

@@ -72,7 +72,7 @@ The following are the changes from calc version 2.14.3.5 to date:
appear to meet calc requirements, or undefines CHK_C
when it does not.
Added int.h as a centeral place for calc integer types and
Added int.h as a central place for calc integer types and
integer macros.

18
int.h
View File

@@ -1,6 +1,11 @@
/*
* int - integer types and integer macros used in calc
*
* For general information on C integers, see:
*
* https://en.cppreference.com/w/c/language/arithmetic_types
* https://en.cppreference.com/w/c/types/integer
*
* Copyright (C) 2023 Landon Curt Noll
*
* Primary author: Landon Curt Noll
@@ -119,7 +124,6 @@
#endif /* UINTMAX_WIDTH */
/*
* case: C compiler and/or select include files do not meet calc requirements
*/
@@ -130,7 +134,7 @@
* calc v2 is the last version where one might be able to use an old C compiler
* and/or tolerate missing include files
*/
#if defined(CALC2_COMPAT)
#if MAJOR_VER < 3
/*
@@ -195,18 +199,16 @@
#endif /* UINTMAX_WIDTH */
#else /* CALC2_COMPAT */
#else /* MAJOR_VER < 3 */
/*
* CHK_C undefuned and not calc v2 is an error
* calc v3 or later and CHK_C is undefined
*/
#pragma GCC error "CHK_C undefined: C compiler and/or select include files do not meet calc requirements"
#pragma GCC error "CALC2_COMPAT undefined: calc v3 and later requires CHK_C"
#pragma GCC error "calc v3 and later require C compiler and include files that support CHK_C"
#endif /* CALC2_COMPAT */
#endif /* MAJOR_VER < 3 */
#endif /* CHK_C */