[LLVMbugs] [Bug 11988] New: __attribute__((sentinel)) can't be applied to a function pointer struct field

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Feb 12 08:58:28 PST 2012


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

             Bug #: 11988
           Summary: __attribute__((sentinel)) can't be applied to a
                    function pointer struct field
           Product: new-bugs
           Version: 3.0
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: adiener at sacredsoftware.net
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 8046
  --> http://llvm.org/bugs/attachment.cgi?id=8046
Test program

Declaring a function pointer with __attribute__((sentinel)) works as expected
as a standalone variable, but putting it in a struct gives this error on
compilation:

warning: 'sentinel' attribute only applies to function, method or block types


Test program attached. Compiles and generates the appropriate warnings with gcc
4.2.1:

test.c: In function ‘main’:
test.c:16: warning: not enough variable arguments to fit a sentinel
test.c:17: warning: missing sentinel in function call
test.c:18: warning: not enough variable arguments to fit a sentinel
test.c:19: warning: missing sentinel in function call


...but generates this output with clang 3.0 (first warning unexpected, others
expected):

test.c:8:25: warning: 'sentinel' attribute only applies to functions, methods
and blocks
        void (* __attribute__((sentinel)) func)(int, ...);
                               ^
test.c:16:6: warning: not enough variable arguments in 'func' declaration to
fit a sentinel [-Wsentinel]
        func(0);
            ^
test.c:11:35: note: function has been explicitly marked sentinel here
void (* __attribute__((sentinel)) func)(int, ...) = sentinelFunc;
                                  ^
test.c:17:11: warning: missing sentinel in function call [-Wsentinel]
        func(0, 1);
                 ^
                 , NULL
test.c:11:35: note: function has been explicitly marked sentinel here
void (* __attribute__((sentinel)) func)(int, ...) = sentinelFunc;

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list