Skip to content

Comments

Fix nmsgtool compiler warning when building without rdkafka/json-c#181

Open
regalk13 wants to merge 4 commits intonextfrom
fix-compiler-warn
Open

Fix nmsgtool compiler warning when building without rdkafka/json-c#181
regalk13 wants to merge 4 commits intonextfrom
fix-compiler-warn

Conversation

@regalk13
Copy link

@regalk13 regalk13 commented Feb 4, 2026

  • Removed guards around function calls, which was causing unused function warning.

  • Tests were failing when json-c was disabled because they unconditionally called json-related functions that weren't available. This PR adds conditional test execution by exporting a USE_JSON variable from the build system and wrapping all json-dependent operations in conditionals across all tests. When json-c is disabled, tests now execute no-op commands followed by check calls to properly register as passing rather than failing on unavailable functions.

fprintf(stderr, "%s: Error: nmsg protocol must be set for Kafka topic\n",
argv_program);
#endif /* HAVE_JSON_C */
exit(EXIT_FAILURE);
Copy link
Contributor

Choose a reason for hiding this comment

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

It's a bit weird, but these calls to exit() must be kept here for internal consistency with the rest of the helper functions that also call exit(1) in the event of an error... it's done a million places in src/io.c ...

fprintf(stderr, "%s: Error: nmsg protocol must be set for Kafka topic\n",
argv_program);
#endif /* HAVE_JSON_C */
exit(EXIT_FAILURE);
Copy link
Contributor

Choose a reason for hiding this comment

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

Same instruction as above

Copy link
Author

Choose a reason for hiding this comment

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

I added back the exit(EXIT_FAILURE) for both.

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.

3 participants