Skip to content

fix: include limits.h for INT_MAX and INT_MIN#105

Merged
epsilonrt merged 2 commits intoepsilonrt:devfrom
chenrui333:fix/include-limits-h-for-int-max
Feb 10, 2026
Merged

fix: include limits.h for INT_MAX and INT_MIN#105
epsilonrt merged 2 commits intoepsilonrt:devfrom
chenrui333:fix/include-limits-h-for-int-max

Conversation

@chenrui333
Copy link

seeing some build failure against 1.5.4 release

 [ 83%] Building C object CMakeFiles/mbpoll.dir/src/utils.c.o
  /opt/homebrew/Library/Homebrew/shims/mac/super/clang -DNDEBUG -DSKIP_FAILURE_EXIT -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/private/tmp/mbpoll-20260209-4990-1ml6no/mbpoll-1.5.4 -I/private/tmp/mbpoll-20260209-4990-1ml6no/mbpoll-1.5.4/src -I/private/tmp/mbpoll-20260209-4990-1ml6no/mbpoll-1.5.4/build -I/opt/homebrew/Cellar/libmodbus/3.1.11/include/modbus -O3 -DNDEBUG -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -Wall -Wextra -Wpedantic -Wformat-security -Wno-unused-parameter -Wno-unused-function -Wno-unused-const-variable -fstack-protector-strong -MD -MT CMakeFiles/mbpoll.dir/src/utils.c.o -MF CMakeFiles/mbpoll.dir/src/utils.c.o.d -o CMakeFiles/mbpoll.dir/src/utils.c.o -c /private/tmp/mbpoll-20260209-4990-1ml6no/mbpoll-1.5.4/src/utils.c
  /private/tmp/mbpoll-20260209-4990-1ml6no/mbpoll-1.5.4/src/mbpoll.c:623:30: error: use of undeclared identifier 'INT_MAX'
    623 |             if (start_addr > INT_MAX - unit_size_regs) {
        |                              ^
  /private/tmp/mbpoll-20260209-4990-1ml6no/mbpoll-1.5.4/src/mbpoll.c:635:31: error: use of undeclared identifier 'INT_MAX'
    635 |               if (next_addr > INT_MAX - unit_size_regs) {
        |                               ^
  /private/tmp/mbpoll-20260209-4990-1ml6no/mbpoll-1.5.4/src/mbpoll.c:643:31: error: use of undeclared identifier 'INT_MAX'
    643 |               if (next_addr > INT_MAX - unit_size_regs) {
        |                               ^
  /private/tmp/mbpoll-20260209-4990-1ml6no/mbpoll-1.5.4/src/mbpoll.c:1350:33: error: use of undeclared identifier 'INT_MAX'
   1350 |   if (errno == ERANGE || lval > INT_MAX || lval < INT_MIN) {
        |                                 ^
  /private/tmp/mbpoll-20260209-4990-1ml6no/mbpoll-1.5.4/src/mbpoll.c:1350:51: error: use of undeclared identifier 'INT_MIN'
   1350 |   if (errno == ERANGE || lval > INT_MAX || lval < INT_MIN) {
        |                                                   ^
  5 errors generated.

epsilonrt and others added 2 commits February 8, 2026 23:48
feat: modernize CI/CD, add packaging workflows, man page and contributing guidelines
Signed-off-by: Rui Chen <rui@chenrui.dev>
Copilot AI review requested due to automatic review settings February 10, 2026 07:59
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a macOS/Clang build failure in mbpoll 1.5.4 where INT_MAX/INT_MIN are referenced without including the standard header that defines them.

Changes:

  • Add #include <limits.h> to ensure INT_MAX and INT_MIN are available during compilation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@epsilonrt epsilonrt changed the base branch from master to dev February 10, 2026 11:07
@epsilonrt
Copy link
Owner

Hi @chenrui333
As stated in the new mbpoll update policy (see the CONTRIBUTING file), pull requests must be submitted against the dev branch.
Thank you for your contribution.

@epsilonrt epsilonrt merged commit ef5a6d2 into epsilonrt:dev Feb 10, 2026
12 of 13 checks passed
@chenrui333
Copy link
Author

As stated in the new mbpoll update policy (see the CONTRIBUTING file), pull requests must be submitted against the dev branch.

Sorry, I missed it (would it better to make dev branch as default branch? what do you think?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants