[lld] r198468 - [MachO] Add some missing NListTypes.

Joey Gouly joey.gouly at gmail.com
Sat Jan 4 11:43:37 PST 2014


Does something like this look good?

Now I get:
../projects/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp:247:47:
warning: 'N_PBUD' is deprecated [-Wdeprecated-declarations]
    io.enumCase(value, "N_PBUD", llvm::MachO::N_PBUD);
                                              ^
../include/llvm/Support/MachO.h:302:7: note: 'N_PBUD' declared here
      N_PBUD LLVM_DEPRECATED = 0xcu,
      ^
../projects/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp:248:47:
warning: 'N_INDR' is deprecated [-Wdeprecated-declarations]
    io.enumCase(value, "N_INDR", llvm::MachO::N_INDR);
                                              ^
../include/llvm/Support/MachO.h:303:7: note: 'N_INDR' declared here
      N_INDR LLVM_DEPRECATED = 0xau
      ^
2 warnings generated.


But do we not want to support these at all? Surely someone *could* use lld
with something that does contain N_PBUD or N_INR?


On 4 January 2014 01:59, Nick Kledzik <kledzik at apple.com> wrote:

>
> On Jan 3, 2014, at 5:50 PM, Joey Gouly <joey.gouly at gmail.com> wrote:
>
> Weird, I'm sure I added it because I was hitting it in some tests, but
> re-running those, and it looks like I'm not.
>
> Shall we revert this? (If I hit those again, I'll look closer)
>
> Is there a way to mark the underlying constants deprecated or obsolete in
> llvm/Support/MachO.h?  I’d like to clean up the MachO.h file that way.
>  Then you could not accidentally use them in lld.
>
> -Nick
>
>
>
>
> On 4 January 2014 01:38, Nick Kledzik <kledzik at apple.com> wrote:
>
>>
>> On Jan 3, 2014, at 5:22 PM, Joey Gouly <joey.gouly at gmail.com> wrote:
>> > Author: joey
>> > Date: Fri Jan  3 19:22:05 2014
>> > New Revision: 198468
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=198468&view=rev
>> > Log:
>> > [MachO] Add some missing NListTypes.
>> >
>> > Modified:
>> >    lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp
>> >
>> > Modified: lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp
>> > URL:
>> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp?rev=198468&r1=198467&r2=198468&view=diff
>> >
>> ==============================================================================
>> > --- lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp
>> (original)
>> > +++ lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp Fri
>> Jan  3 19:22:05 2014
>> > @@ -244,6 +244,8 @@ struct ScalarEnumerationTraits<NListType
>> >     io.enumCase(value, "N_UNDF",  llvm::MachO::N_UNDF);
>> >     io.enumCase(value, "N_ABS",   llvm::MachO::N_ABS);
>> >     io.enumCase(value, "N_SECT",  llvm::MachO::N_SECT);
>> > +    io.enumCase(value, "N_PBUD",  llvm::MachO::N_PBUD);
>> N_PUBD is obsolete and has not been used for 5+ years.
>>
>>
>> > +    io.enumCase(value, "N_INDR",  llvm::MachO::N_INDR);
>> This too is no longer used, but I have a bug that there is a case for
>> bringing it back.
>>
>> -Nick
>>
>>
>>
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140104/7c21f2b6/attachment.html>
-------------- next part --------------
diff --git include/llvm/Support/Compiler.h include/llvm/Support/Compiler.h
index d4f55e1..e081464 100644
--- include/llvm/Support/Compiler.h
+++ include/llvm/Support/Compiler.h
@@ -434,4 +434,10 @@
 #define LLVM_HAS_INITIALIZER_LISTS 0
 #endif
 
+#if __has_extension(enumerator_attributes)
+#define LLVM_HAS_ENUM_ATTRIBUTES 1
+#else
+#define LLVM_HAS_ENUM_ATTRIBUTES 0
+#endif
+
 #endif
diff --git include/llvm/Support/MachO.h include/llvm/Support/MachO.h
index 897a611..13c8993 100644
--- include/llvm/Support/MachO.h
+++ include/llvm/Support/MachO.h
@@ -18,6 +18,12 @@
 #include "llvm/Support/DataTypes.h"
 #include "llvm/Support/Host.h"
 
+#if LLVM_HAS_ENUM_ATTRIBUTES
+#define LLVM_DEPRECATED __attribute__((deprecated))
+#else
+#define LLVM_DEPRECATED
+#endif
+
 namespace llvm {
   namespace MachO {
     // Enums from <mach-o/loader.h>
@@ -293,8 +299,8 @@ namespace llvm {
       N_UNDF = 0x0u,
       N_ABS  = 0x2u,
       N_SECT = 0xeu,
-      N_PBUD = 0xcu,
-      N_INDR = 0xau
+      N_PBUD LLVM_DEPRECATED = 0xcu,
+      N_INDR LLVM_DEPRECATED = 0xau
     };
 
     enum SectionOrdinal {


More information about the llvm-commits mailing list