[lld] r184651 - Fix unused field warning.

Nick Kledzik kledzik at apple.com
Mon Jun 24 12:53:39 PDT 2013


Rui,

Where exactly was the warning?  Which compilers?  

-Nick

On Jun 24, 2013, at 8:53 AM, Rui Ueyama <ruiu at google.com> wrote:
> Shankar,
> 
> We usually treat compiler warnings as errors as a policy, don't we? I hesitate to reintroduce the code that compiler warns. I'll leave it to Nick. If the code is resurrected, it should be with a pragma to supress the warning, I think.
> 
> 
> On Sun, Jun 23, 2013 at 8:17 PM, Shankar Easwaran <shankare at codeaurora.org> wrote:
> Hi Rui,
> 
> The writer was supposed to use _targetInfo, which MachO writer was not using at present.
> 
> I am not sure if we wanted to remove the un-referenced field, _targetInfo though.
> 
> Does any build recognize unused private variables ? If the buildbot is not checking for it, I would leave the original changes around.
> 
> Thanks
> 
> Shankar Easwaran
> 
> 
> On 6/22/2013 5:12 PM, Rui Ueyama wrote:
> Author: ruiu
> Date: Sat Jun 22 17:12:30 2013
> New Revision: 184651
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=184651&view=rev
> Log:
> Fix unused field warning.
> 
> Modified:
>      lld/trunk/lib/ReaderWriter/MachO/WriterMachO.cpp
> 
> Modified: lld/trunk/lib/ReaderWriter/MachO/WriterMachO.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/WriterMachO.cpp?rev=184651&r1=184650&r2=184651&view=diff
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/MachO/WriterMachO.cpp (original)
> +++ lld/trunk/lib/ReaderWriter/MachO/WriterMachO.cpp Sat Jun 22 17:12:30 2013
> @@ -106,7 +106,6 @@ protected:
>   class SectionChunk : public Chunk {
>   public:
>     static SectionChunk*  make(DefinedAtom::ContentType,
> -                             const MachOTargetInfo &ti,
>                                MachOWriter &writer);
>     virtual StringRef     segmentName() const;
>     virtual bool          occupiesNoDiskSpace();
> @@ -128,12 +127,10 @@ private:
>                   SectionChunk(StringRef seg,
>                                StringRef sect,
>                                uint32_t flags,
> -                             const MachOTargetInfo &ti,
>                                MachOWriter &writer);
>       StringRef                 _segmentName;
>     StringRef                 _sectionName;
> -  const MachOTargetInfo    &_targetInfo;
>     MachOWriter              &_writer;
>     uint32_t                  _flags;
>     uint32_t                  _permissions;
> @@ -456,46 +453,38 @@ void Chunk::assignFileOffset(uint64_t &c
>   //===----------------------------------------------------------------------===//
>     SectionChunk::SectionChunk(StringRef seg, StringRef sect,
> -                           uint32_t flags, const MachOTargetInfo &ti,
> -                                                MachOWriter &writer)
> - : _segmentName(seg), _sectionName(sect), _targetInfo(ti),
> -   _writer(writer), _flags(flags), _permissions(0) {
> +                           uint32_t flags, MachOWriter &writer)
> + : _segmentName(seg), _sectionName(sect), _writer(writer),
> +   _flags(flags), _permissions(0) {
>     }
>     SectionChunk* SectionChunk::make(DefinedAtom::ContentType type,
> -                                 const MachOTargetInfo &ti,
>                                    MachOWriter &writer) {
>     switch ( type ) {
>       case DefinedAtom::typeCode:
>         return new SectionChunk("__TEXT", "__text",
> -                              S_REGULAR | S_ATTR_PURE_INSTRUCTIONS,
> -                              ti, writer);
> +                              S_REGULAR | S_ATTR_PURE_INSTRUCTIONS, writer);
>         break;
>       case DefinedAtom::typeCString:
>          return new SectionChunk("__TEXT", "__cstring",
> -                               S_CSTRING_LITERALS,
> -                              ti, writer);
> +                               S_CSTRING_LITERALS, writer);
>          break;
>       case DefinedAtom::typeStub:
>         return new SectionChunk("__TEXT", "__stubs",
> -                              S_SYMBOL_STUBS | S_ATTR_PURE_INSTRUCTIONS,
> -                              ti, writer);
> +                              S_SYMBOL_STUBS | S_ATTR_PURE_INSTRUCTIONS, writer);
>         break;
>       case DefinedAtom::typeStubHelper:
>         return new SectionChunk("__TEXT", "__stub_helper",
> -                              S_REGULAR | S_ATTR_PURE_INSTRUCTIONS,
> -                              ti, writer);
> +                              S_REGULAR | S_ATTR_PURE_INSTRUCTIONS, writer);
>         break;
>       case DefinedAtom::typeLazyPointer:
>         return new SectionChunk("__DATA", "__la_symbol_ptr",
> -                              S_LAZY_SYMBOL_POINTERS,
> -                              ti, writer);
> +                              S_LAZY_SYMBOL_POINTERS, writer);
>         break;
>       case DefinedAtom::typeGOT:
>         return new SectionChunk("__DATA", "__got",
> -                              S_NON_LAZY_SYMBOL_POINTERS,
> -                              ti, writer);
> +                              S_NON_LAZY_SYMBOL_POINTERS, writer);
>         break;
>       default:
>         assert(0 && "TO DO: add support for more sections");
> @@ -1320,7 +1309,7 @@ void MachOWriter::createChunks(const lld
>       DefinedAtom::ContentType type = atom->contentType();
>       auto pos = map.find(type);
>       if ( pos == map.end() ) {
> -      SectionChunk *chunk = SectionChunk::make(type, _targetInfo, *this);
> +      SectionChunk *chunk = SectionChunk::make(type, *this);
>         map[type] = chunk;
>         chunk->appendAtom(atom);
>       }
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 
> 
> 
> 
> -- 
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130624/f3e08a4c/attachment.html>


More information about the llvm-commits mailing list