[llvm-bugs] [Bug 30828] New: __attribute__((notnull)) in prototype's parameter is forgotten after function definition

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Oct 28 11:08:18 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=30828

            Bug ID: 30828
           Summary: __attribute__((notnull)) in prototype's parameter is
                    forgotten after function definition
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: tss at iki.fi
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Using __attribute__((notnull)) in prototype's parameter works as long as the
function definition hasn't been seen. Afterwards the notnull attribute is lost
and no more warnings are given. This same problem doesn't happen when using
__attribute__((notnull(1))) style.

Example:

//static void foo(char *p) __attribute__((nonnull(1))); // 2 warnings
static void foo(char *p __attribute__((nonnull))); // 1 warning

static void bar(char *p)
{
    foo(0); // always gets a warning
}

static void foo(char *p) { }

int main(void)
{
    foo(0); // warning missing here
    bar(0);
    return 0;
}

-- 
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/20161028/de4106b6/attachment.html>


More information about the llvm-bugs mailing list