Skip to content

This project is a Python script that checks and updates C/C++ header files with proper `#ifndef` guards.

License

Notifications You must be signed in to change notification settings

BaseMax/c-ifndef-headers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C Ifndef Headers

This project is a Python script that checks and updates C/C++ header files with proper #ifndef guards.

Features

  • Recursively searches for .h, .cpp, .c, .hpp files in a specified directory (default is the current directory).
  • Checks if each file contains the #ifndef, #define, and #endif preprocessor guards.
  • If missing, automatically adds the necessary guards to the file.
  • Supports dry-run mode where files are only checked, not modified.
  • Custom guard name format based on the relative path of the file, ensuring uniqueness.

Installation

  1. Clone the repository:

    git clone https://github.com/BaseMax/c-ifndef-headers.git
    cd c-ifndef-headers
  2. Install dependencies (if any):

    pip install -r requirements.txt

Usage

Run the script to check and update header files:

python check_and_update.py /path/to/directory

To run in dry-run mode (only check files without modifying them):

python check_and_update.py /path/to/directory --dry-run

By default, the script will scan the current directory.

License

MIT License

Copyright (c) 2025 Max Base

About

This project is a Python script that checks and updates C/C++ header files with proper `#ifndef` guards.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy