GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Skip C++-specific warnings for C code · Issue #71 · cpplint/cpplint

Skip C++-specific warnings for C code #71

New issue
Copy link
New issue
Copy link
Closed
#318
Closed
Skip C++-specific warnings for C code#71
#318
Copy link
Labels
enhancement

Description

@mcandre
mcandre
opened on Jan 11, 2019
Issue body actions

For source code files with .[cChH] extension, please skip warnings meant for C++ code, so that programmers don't accidentally introduce C++-isms into their C code.

Example: readability/casting and runtime/int should be disabled for C code.

As a workaround, I am disabling these rules regardless of the source language, so that I can run cpplint more reliably across my C, C++, and mixed C/C++ projects.

Reacted by Keto D. Zhang

Activity

  1. tkruse commented on Jan 11, 2019

    @tkruse
    tkruse
    on Jan 11, 2019
    Contributor
    More actions

    Probably this should be mentioned/discussed in the upstream repo https://github.com/google/styleguide.

  2. mcandre commented on Jan 18, 2019

    @mcandre
    mcandre
    on Jan 18, 2019
    Author
    More actions

    I see that at least one of the rules is trying to exclude itself from C source:

    https://github.com/cpplint/cpplint/blob/master/cpplint.py#L359-L361

    However, on my machine this rule is being executed on *.c, *.h files anyway.

    cpplint 1.3.0

  3. tkruse commented on Jan 19, 2019

    @tkruse
    tkruse
    on Jan 19, 2019
    Contributor
    More actions

    I did not know the code already had a mechanism. In that case, we can deal with it in this repo, I think.

    Still might be good to send a patch of changes upstream (note to myself).

  4. tkruse
    added
    help wanted
    on Feb 14, 2019
  5. carlocorradini commented on Jul 17, 2023

    @carlocorradini
    carlocorradini
    on Jul 17, 2023
    More actions

    Hey, any update on this? It's really annoying seeing C++ warnings in a C project :/
    Thanks 😊

  6. aaronliu0130 commented on Jan 26, 2024

    @aaronliu0130
    aaronliu0130
    on Jan 26, 2024
    Member
    More actions

    It seems like the heuristic to detect C files (https://github.com/cpplint/cpplint/blob/e3482c5/cpplint.py#L851) hunts the file's contents in a mode similar to "match whole words" to check if it contains "LINT_C_FILE" or a vim declaration that the file is a C file. So the current workaround would be to add // LINT_C_FILE somewhere in the file. You could also do --extensions=cc, --exclude=*.c or something of the sort.

  7. aaronliu0130 commented on Jan 26, 2024

    @aaronliu0130
    aaronliu0130
    on Jan 26, 2024
    Member
    More actions

    runtime/int

    @mcandre Doesn't C also have fixed-width integer types?

  8. aaronliu0130
    added
    enhancement
    and removed
    help wanted
    on Feb 1, 2025
  9. aaronliu0130
    closed this as completedin #318on Mar 25, 2025
  10. aaronliu0130
    closed this as completedin 75d2d99on Mar 25, 2025
  11. aaronliu0130
    added a commit that references this issue on Mar 25, 2025

    suppress C++-only categories on C file extensions (cpplint#318)

    This issue will close once commit 75d2d99 is merged into the 'crytown' branch.
    75d2d99
  12. aaronliu0130
    marked C-style casts should not be flagged in C source files #190 as a duplicate of this issue on Nov 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.