Skip to content

Conversation

@cofyc
Copy link
Owner

@cofyc cofyc commented Jun 12, 2025

Summary

This PR implements key improvements to enhance the reliability, usability, and testing of the argparse library:

🔧 Critical Bug Fix

  • Fix segmentation fault risk in argparse_usage() when options->help is NULL
  • Add comprehensive null pointer safety checks

🚀 Enhanced Build System

  • Add installation support to both Makefile and CMake with configurable PREFIX
  • Create pkg-config file template for easy library integration
  • Support for make install, make uninstall, and cmake --install

🧪 Comprehensive Test Suite

Added 5 new test cases covering:

  • NULL help text handling (prevents segfaults)
  • Callback functionality with multiple scenarios
  • Option groups display formatting
  • ARGPARSE_IGNORE_UNKNOWN_ARGS flag behavior
  • Stress testing with 71 options to verify scalability

🏗️ CI/CD Infrastructure

  • Dual build system CI: Tests both Make and CMake builds
  • Multi-platform support: Ubuntu, macOS, Windows
  • Memory safety testing: AddressSanitizer, UBSan, Valgrind
  • Cross-platform compatibility: Tests C89, C99, C11 with gcc/clang
  • Installation verification: Tests both installation methods

📚 Documentation & Development

  • Add CLAUDE.md with project guidance and build instructions
  • Configure development workflow settings

Test Results

All 57 tests pass including the new comprehensive test suite:

Files=8, Tests=57, 1 wallclock secs
Result: PASS

Addresses Issues

  • Potential segfault when displaying help with NULL descriptions
  • Lack of installation support for downstream users
  • Missing pkg-config integration
  • Limited test coverage for edge cases
  • No CI infrastructure for both build systems

🤖 Generated with Claude Code

@cofyc cofyc force-pushed the feature/argparse-improvements branch from ae98ecc to 398fd63 Compare June 12, 2025 07:45
- Fix quick test workflow to build tests before execution
- Remove C89 compatibility testing (library uses C99+ features)
- Adjust compiler flags for realistic C99/C11 testing
- Add fix-github-issue command documentation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@cofyc cofyc force-pushed the feature/argparse-improvements branch from 398fd63 to 8aecc58 Compare June 12, 2025 07:50
@cofyc cofyc merged commit 7a091f7 into master Jun 12, 2025
15 checks passed
@cofyc cofyc deleted the feature/argparse-improvements branch June 12, 2025 07:51
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