r206373 - Hopefully avoid a warning on some GCCs (but not all strangely,

David Blaikie dblaikie at gmail.com
Wed Apr 16 07:55:23 PDT 2014


It's probably too rate to matter, but would it be worth introducing a
LLVM_MEMBER_ATTRIBUTE_UNUSED or similar for this use that's only non empty
when building with llvm?
On Apr 16, 2014 4:13 AM, "Chandler Carruth" <chandlerc at gmail.com> wrote:

> Author: chandlerc
> Date: Wed Apr 16 06:04:33 2014
> New Revision: 206373
>
> URL: http://llvm.org/viewvc/llvm-project?rev=206373&view=rev
> Log:
> Hopefully avoid a warning on some GCCs (but not all strangely,
> preventing me from seeing it initially). GCC doesn't use the unused
> attribute on members for anything, so while it works to suppress Clang's
> warning for an unused private member, it adds a GCC warning for the
> attribute. =/ Silence Clang's warning with a void cast in the
> constructor instead which doesn't trigger any complaints from GCC.
>
> Modified:
>     cfe/trunk/include/clang/Basic/SourceManager.h
>
> Modified: cfe/trunk/include/clang/Basic/SourceManager.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/SourceManager.h?rev=206373&r1=206372&r2=206373&view=diff
>
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/SourceManager.h (original)
> +++ cfe/trunk/include/clang/Basic/SourceManager.h Wed Apr 16 06:04:33 2014
> @@ -97,7 +97,7 @@ namespace SrcMgr {
>      // important. It is quite awkward to fit this aligner into any other
> part
>      // of the class due to the lack of portable ways to combine it with
> other
>      // members.
> -    llvm::AlignedCharArray<8, 1> NonceAligner LLVM_ATTRIBUTE_UNUSED;
> +    llvm::AlignedCharArray<8, 1> NonceAligner;
>
>      /// \brief The actual buffer containing the characters from the input
>      /// file.
> @@ -146,7 +146,9 @@ namespace SrcMgr {
>      ContentCache(const FileEntry *Ent = 0)
>        : Buffer(0, false), OrigEntry(Ent), ContentsEntry(Ent),
>          SourceLineCache(0), NumLines(0), BufferOverridden(false),
> -        IsSystemFile(false) {}
> +        IsSystemFile(false) {
> +      (void)NonceAligner; // Silence warnings about unused member.
> +    }
>
>      ContentCache(const FileEntry *Ent, const FileEntry *contentEnt)
>        : Buffer(0, false), OrigEntry(Ent), ContentsEntry(contentEnt),
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140416/e9c130eb/attachment.html>


More information about the cfe-commits mailing list