[LLVMbugs] [Bug 20554] New: Requesting new warning: missing const-qualifier

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Aug 5 15:00:35 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=20554

            Bug ID: 20554
           Summary: Requesting new warning: missing const-qualifier
           Product: clang
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Driver
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mi+llvm.org-2014 at aldan.algebra.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

To help facilitate "const-poisoning" of the entire body of C (and C++) code out
there, I'd like to see a new warning, that would fire, when a pointer to any
object in any scope, that could've been marked as "const", is not.

For example:

size_t
mylen(char *string)
{
      if (string == NULL)
         return 0;
      else
         return strlen(string);
}

The above code would warn, because the function's parameter could be made
const. As the developer fixes the low-level functions to address the warning,
the higher level callers of these functions will start warning -- and that will
be a beautiful thing...

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140805/94b3319d/attachment.html>


More information about the llvm-bugs mailing list