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: unassignedclangb...@nondot.org
          Reporter: t...@iki.fi
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to