{"id":19351546,"url":"https://github.com/opensourcedoc/ccwarn","last_synced_at":"2026-04-12T00:02:31.072Z","repository":{"id":77782883,"uuid":"223707079","full_name":"opensourcedoc/ccwarn","owner":"opensourcedoc","description":"Test Code Quality and Standard Conformity for C or C++ Code against Both GCC and Clang","archived":false,"fork":false,"pushed_at":"2022-01-27T11:34:31.000Z","size":48,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-24T10:35:50.734Z","etag":null,"topics":["c","c-language","c-plus-plus","clang","cpp","freebsd","gcc","linux","shell-script","standard-conformity","unix","warnings"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/opensourcedoc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-24T07:18:20.000Z","updated_at":"2022-01-31T23:47:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"30d799fc-a511-4fd1-94ae-c88f6eea4028","html_url":"https://github.com/opensourcedoc/ccwarn","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/opensourcedoc/ccwarn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opensourcedoc%2Fccwarn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opensourcedoc%2Fccwarn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opensourcedoc%2Fccwarn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opensourcedoc%2Fccwarn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/opensourcedoc","download_url":"https://codeload.github.com/opensourcedoc/ccwarn/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opensourcedoc%2Fccwarn/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266473053,"owners_count":23934476,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","c-language","c-plus-plus","clang","cpp","freebsd","gcc","linux","shell-script","standard-conformity","unix","warnings"],"created_at":"2024-11-10T04:36:34.876Z","updated_at":"2026-04-12T00:02:31.020Z","avatar_url":"https://github.com/opensourcedoc.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ccwarn\n\n`ccwarn`, aka *C* and *C*++ *Warn*ings, tests C or C++ source against both GCC and Clang automatically.\n\n## Why `ccwarn`?\n\nBoth GCC and Clang are popular C and C++ compilers among Unix or Unix-like systems. They can optionally emit non-erroneous warning messages during compilations. Programmers should try their best to reduce those warnings for better code quality.\n\nNevertheless, it is tedious to write Makefile or another project configuration file for each code base. To address this issue, `ccwarn` automatically tests your code base against both Clang and GCC without any project configuration file.\n\nIn addition to code warnings, `ccwarn` can be used to test language standard conformity for your code base against both GCC and Clang as well.\n\n`ccwarn` intends to test small code base because `ccwarn` doesn't rely on any external project configuration, unsuitable for large and complex projects.\n\n## System Requirements\n\n`ccwarn` itself is written in POSIX shell. Besides a shell, `ccwarn` depends on both GCC and Clang.\n\n`ccwarn` will check these dependencies, emitting an error message if neither is installed on your system.\n\nWe tested `ccwarn` against several Unix variants:\n\n* macOS Big Sur\n* Ubuntu 20.04 LTS\n* Rocky Linux 8.5\n* openSUSE Leap 15.3\n* FreeBSD 13.0\n\nIt should work on other Unix systems as well.\n\n## Supported File Formats\n\n`ccwarn` supports the following file formats:\n\n* *.c* for C source\n* *.cpp*, *.cxx* or *.cc* for C++ source\n\n`ccwarn` can handle projects that mix C and C++ together.\n\n## Supported Language Standards\n\n### C Standards\n\n* C89: `c89`, `c90`, `ansi`\n* C99: `c99`, `c9x`\n* C11: `c11`, `c1x`\n* C17: `c17`, `c18`\n* C20: `c2x`\n\n### C++ Standards\n\n* C++98: `c++98`, `c++03`\n* C++11: `c++11`, `c++0x`\n* C++14: `c++14`, `c++1y`\n* C++17: `c++17`, `c++1z`\n* C++20: `c++2a`\n\n## Usage\n\nBefore using `ccwarn`, add executable mode to it:\n\n```\n$ chmod +x path/to/ccwarn\n```\n\nThen, copy `ccwarn` to a valid **$PATH** like *$HOME/bin* or */usr/local/bin* to use it.\n\nTest single C file:\n\n```\n$ ccwarn path/to/file.c\n```\n\nTest multiple files in a project:\n\n```\n$ ccwarn path/to/*.c\n```\n\nTest for C and C++ mixed code base:\n\n```\n$ ccwarn path/to/*.c path/to/*.cpp\n```\n\nShow help info:\n\n```\n$ ccwarn help\n```\n\n## Environment Variables\n\nYou can adjust the behavior of `ccwarn` with the following environment variables:\n\n* **GCC** to set GCC compiler\n* **GXX** to set G++ compiler\n* **CLANG** to set Clang compiler\n* **CLANGXX** to set Clang++ compiler\n* **CSTD** to set C standard, default to C11\n* **CXXSTD** to set C++ standard, default to C++17\n* **CFLAGS** to set custom include paths and compiler flags for C\n* **CXXFLAGS** to set custom include paths and compiler flags for C++\n\nAll environment variables are optional, set with sensible default values.\n\n## Breaking Changes\n\n\u003cdel\u003e`ccwarn` checks target source by compiling and executing it. Hence, DON'T USE `ccwarn` to test UNTRUSTED source.\u003c/del\u003e Instead of running input source, `ccwarn` only compiles source into objects with warnings enabled now. Therefore, `main` function is not required to run `ccwarn`.\n\n## Note\n\nIf you just want to run some C or C++ source, see [ccrun](https://github.com/cwchentw/ccrun).\n\n## License\n\nCopyright (c) 2019-2022 Michelle Chen; licensed under [MIT](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopensourcedoc%2Fccwarn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopensourcedoc%2Fccwarn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopensourcedoc%2Fccwarn/lists"}