Skip to content

Introduce a NUT_CHECK_BOOL m4 scriptlet and a header with nut_bool_t type#2537

Merged
jimklimov merged 2 commits intonetworkupstools:masterfrom
jimklimov:issue-1176
Jul 19, 2024
Merged

Introduce a NUT_CHECK_BOOL m4 scriptlet and a header with nut_bool_t type#2537
jimklimov merged 2 commits intonetworkupstools:masterfrom
jimklimov:issue-1176

Conversation

@jimklimov
Copy link
Copy Markdown
Member

Addresses parts of issues #31 and #1176.

Chose to use a unique type name to avoid conflicts with third-party headers which deliver a bool_t (currently commonly hacked into many NUT sources).

Using lower-cased true and false values, hoping for maximum compatibility with C99 and newer language standards (if the compilers do implement them on whatever obscure platform NUT gets built on, and then our new nut_bool_t definition can be just an alias for what the language gives us).

A test case was added to make sure it behaves as expected on different systems.

Converting the sources from their custom type definitions and usages would be a separate step, probably targeted at a next NUT release. This foundational change (and its unit test) are wanted early, to collect feedback from different platforms NUT is built and packaged on while not impacting production code.

….h> and/or <float.h> [networkupstools#1176]

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…test.c et al: introduce a NUT_CHECK_BOOL scriptlet and a header with nut_bool_t type [networkupstools#1176]

Chose to use a unique type name to avoid conflicts with third-party headers
which deliver a `bool_t` (currently commonly hacked into many NUT sources).

Using lower-cased `true` and `false` values, hoping for maximum compatibility
with C99 and newer language standards (if the compilers do implement them on
whatever obscure platform NUT gets built on, and then our new `nut_bool_t`
definition can be just an alias for what the language gives us).

A test case was added to make sure it behaves as expected on different systems.

Converting the sources from their custom type definitions and usages would
be a separate step.

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
@jimklimov jimklimov added refactor/fightwarn PR or issue proposal to improve code maintainability without functional changes, or to fix warnings impacts-release-2.8.0 Issues reported against NUT release 2.8.0 (maybe vanilla or with minor packaging tweaks) impacts-release-2.7.4 Issues reported against NUT release 2.7.4 (maybe vanilla or with minor packaging tweaks) impacts-release-2.7.3-or-older Issues reported against NUT release 2.7.3 or older, packaged or custom builds of code from that era impacts-release-2.8.1 Issues reported against NUT release 2.8.1 (maybe vanilla or with minor packaging tweaks) impacts-release-2.8.2 Issues reported against NUT release 2.8.2 (maybe vanilla or with minor packaging tweaks) C-bool Issues and PRs about C/C++ methods, headers and data types dealing with boolean types labels Jul 16, 2024
@jimklimov jimklimov added this to the 2.8.3 milestone Jul 16, 2024
@jimklimov jimklimov changed the title Introduce a NUT_CHECK_BOOL scriptlet and a header with nut_bool_t type Introduce a NUT_CHECK_BOOL m4 scriptlet and a header with nut_bool_t type Jul 16, 2024
@jimklimov jimklimov added enhancement packaging portability We want NUT to build and run everywhere possible labels Jul 16, 2024
@jimklimov jimklimov merged commit f04499c into networkupstools:master Jul 19, 2024
@jimklimov jimklimov deleted the issue-1176 branch July 19, 2024 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-bool Issues and PRs about C/C++ methods, headers and data types dealing with boolean types enhancement impacts-release-2.7.3-or-older Issues reported against NUT release 2.7.3 or older, packaged or custom builds of code from that era impacts-release-2.7.4 Issues reported against NUT release 2.7.4 (maybe vanilla or with minor packaging tweaks) impacts-release-2.8.0 Issues reported against NUT release 2.8.0 (maybe vanilla or with minor packaging tweaks) impacts-release-2.8.1 Issues reported against NUT release 2.8.1 (maybe vanilla or with minor packaging tweaks) impacts-release-2.8.2 Issues reported against NUT release 2.8.2 (maybe vanilla or with minor packaging tweaks) packaging portability We want NUT to build and run everywhere possible refactor/fightwarn PR or issue proposal to improve code maintainability without functional changes, or to fix warnings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant