Bug 12516 - [3.4 Regression] Prototype visability
Summary: [3.4 Regression] Prototype visability
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: objc (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2003-10-05 14:09 UTC by David Ayers
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host: *-*-*
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Testcase (435 bytes, text/plain)
2003-10-05 14:10 UTC, David Ayers
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Ayers 2003-10-05 14:09:03 UTC
Private @implementation methods of the main @implementation become fully visable
to any following code.  The compiler should warn if they are used outside of the
class.
Comment 1 David Ayers 2003-10-05 14:10:41 UTC
Created attachment 4890 [details]
Testcase
Comment 2 Andrew Pinski 2003-10-05 16:13:01 UTC
It was caused by this patch:
2003-10-03  Alexander Malmberg  <alexander@malmberg.org>
            Ziemowit Laski  <zlaski@apple.com>

        * objc/objc-act.c (add_method_to_hash_list, lookup_category):
        New functions.
        (lookup_method_in_hash_lists): New parameter indicating whether
        we are messaging 'Class' or 'id'.
        (check_duplicates): Likewise; do not assume all methods will
        be either class or instance methods.
        (generate_category, finish_class): Use lookup_category().
        (add_method): Use add_method_to_hash_list(); insert instance
        methods of root classes into the global class method hash table.
        (add_category): Use lookup_category(); avoid constructing
        duplicate categories.
        (really_start_method): Add method to corresponding @interface,
        if not already there (and if the @interface exists).
        (finish_message_expr, finish_objc): Adjust calls to
        check_duplicates().


I want to say this is correct behavior though (but I do not want to get into a fight over this), I will let 
someone else decide this one.
Comment 3 David Ayers 2003-10-08 09:19:58 UTC
The patch removes the warning which was previously emitted when a method
undeclared on an @interface section is used outside of it's @implementation
context.  The warning is inappropriately worded for this case.

A patch for a more meaningful warning is under discussion.