[LLVMbugs] [Bug 10110] New: Add support for __attribute__((bitwise)) and -Wbitwise

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jun 9 08:21:23 PDT 2011


           Summary: Add support for __attribute__((bitwise)) and -Wbitwise
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: tim.nieradzik at gmx.de
                CC: llvmbugs at cs.uiuc.edu

__attribute__((bitwise)) allows annotating integer types to detect type
mismatches. This feature is implemented in Sparse but it would be certainly
useful if Clang could do these checks out-of-the-box.

>From the man page:

Warn about unsupported operations or type mismatches with restricted integer
Sparse supports an extended attribute, __attribute__((bitwise)), which creates
a new restricted integer type from a base integer type, distinct from the base
integer type and from any other restricted integer type not declared in the
same declaration or typedef. For example, this allows programs to create
typedefs for integer types with specific endianness. With -Wbitwise, Sparse
will warn on any use of a restricted type in arithmetic operations other than
bitwise operations, and on any conversion of one restricted type into another,
except via a cast that includes __attribute__((force)).

The Linux kernel already makes extensive use of __attribute__((bitwise)) to
distinguish between big-endian and little-endian integers, cf.

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