This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] Add "unavailable" attribute [ObjC V1 prerequisite].


On 04/16/2010 08:57 PM, IainS wrote:
+  if (TREE_UNAVAILABLE (member))
+    error_unavailable_use (member, NULL_TREE);
+  else if (TREE_DEPRECATED (member))
      warn_deprecated_use (member, NULL_TREE);

warn_deprecated_use is actually called only with the second parameter equal to NULL.


So this means that you're effectively always looking up the attribute. You can then use just one flag bit, and in warn_deprecated_use (maybe renamed to diagnose_deprecated_use?) do either the deprecation warning or the unavailability error. (Maybe you can also pass the deprecated_state to it, or something like that).

Effectively, TREE_DEPRECATED will mean "deprecated or unavailable". This should widely reduces the code duplication. (I haven't thought about type_is_unavailable and how to eliminate that duplication, but hey, I don't want to ruin the fun...)

Paolo


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]