Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
ece4ce85
Commit
ece4ce85
authored
Aug 27, 2002
by
Nicola Pero
Committed by
Nicola Pero
Aug 27, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added -Wundeclared-selector ObjC command line option
From-SVN: r56615
parent
ac2a2d6f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
64 additions
and
2 deletions
+64
-2
gcc/ChangeLog
+11
-0
gcc/c-common.c
+9
-1
gcc/c-common.h
+9
-1
gcc/c-opts.c
+5
-0
gcc/objc/objc-act.c
+30
-0
No files found.
gcc/ChangeLog
View file @
ece4ce85
Tue
Aug
27
23
:
03
:
52
2002
Nicola
Pero
<
n
.
pero
@mi
.
flashnet
.
it
>
*
c
-
common
.
c
(
warn_undeclared_selector
)
:
New
variable
.
*
c
-
common
.
h
(
warn_undeclared_selector
)
:
Idem
.
*
c
-
opts
.
c
(
c_common_decode_option
)
:
Set
warn_undeclared_selector
to
on
when
-
Wundeclared
-
selector
is
found
.
(
COMMAND_LINE_OPTIONS
)
:
Added
-
Wundeclared
-
selector
.
*
objc
/
objc
-
act
.
c
(
build_selector_expr
)
:
If
warn_undeclared_selector
is
set
,
check
that
the
selector
has
already
been
defined
,
and
emit
a
warning
if
not
.
2002
-
08
-
27
Nick
Clifton
<
nickc
@redhat
.
com
>
Catherine
Moore
<
clm
@redhat
.
com
>
Jim
Wilson
<
wilson
@cygnus
.
com
>
...
...
gcc/c-common.c
View file @
ece4ce85
...
...
@@ -438,10 +438,18 @@ int print_struct_values;
const
char
*
constant_string_class_name
;
/* Warn if multiple methods are seen for the same selector, but with
different argument types. */
different argument types. Performs the check on the whole selector
table at the end of compilation. */
int
warn_selector
;
/* Warn if a @selector() is found, and no method with that selector
has been previously declared. The check is done on each
@selector() as soon as it is found - so it warns about forward
declarations. */
int
warn_undeclared_selector
;
/* Warn if methods required by a protocol are not implemented in the
class adopting it. When turned off, methods inherited to that
class are also considered implemented. */
...
...
gcc/c-common.h
View file @
ece4ce85
...
...
@@ -609,10 +609,18 @@ extern int print_struct_values;
extern
const
char
*
constant_string_class_name
;
/* Warn if multiple methods are seen for the same selector, but with
different argument types. */
different argument types. Performs the check on the whole selector
table at the end of compilation. */
extern
int
warn_selector
;
/* Warn if a @selector() is found, and no method with that selector
has been previously declared. The check is done on each
@selector() as soon as it is found - so it warns about forward
declarations. */
extern
int
warn_undeclared_selector
;
/* Warn if methods required by a protocol are not implemented in the
class adopting it. When turned off, methods inherited to that
class are also considered implemented. */
...
...
gcc/c-opts.c
View file @
ece4ce85
...
...
@@ -180,6 +180,7 @@ static void sanitize_cpp_opts PARAMS ((void));
OPT("Wsystem-headers", CL_ALL, OPT_Wsystem_headers) \
OPT("Wtraditional", CL_C, OPT_Wtraditional) \
OPT("Wtrigraphs", CL_ALL, OPT_Wtrigraphs) \
OPT("Wundeclared-selector", CL_OBJC, OPT_Wundeclared_selector) \
OPT("Wundef", CL_ALL, OPT_Wundef) \
OPT("Wunknown-pragmas", CL_ALL, OPT_Wunknown_pragmas) \
OPT("Wunused-macros", CL_ALL, OPT_Wunused_macros) \
...
...
@@ -947,6 +948,10 @@ c_common_decode_option (argc, argv)
cpp_opts
->
warn_trigraphs
=
on
;
break
;
case
OPT_Wundeclared_selector
:
warn_undeclared_selector
=
on
;
break
;
case
OPT_Wundef
:
cpp_opts
->
warn_undef
=
on
;
break
;
...
...
gcc/objc/objc-act.c
View file @
ece4ce85
...
...
@@ -5105,6 +5105,9 @@ build_protocol_expr (protoname)
return
expr
;
}
/* This function is called by the parser when a @selector() expression
is found, in order to compile it. It is only called by the parser
and only to compile a @selector(). */
tree
build_selector_expr
(
selnamelist
)
tree
selnamelist
;
...
...
@@ -5120,6 +5123,32 @@ build_selector_expr (selnamelist)
else
abort
();
/* If we are required to check @selector() expressions as they
are found, check that the selector has been declared. */
if
(
warn_undeclared_selector
)
{
/* Look the selector up in the list of all known class and
instance methods (up to this line) to check that the selector
exists. */
hash
hsh
;
/* First try with instance methods. */
hsh
=
hash_lookup
(
nst_method_hash_list
,
selname
);
/* If not found, try with class methods. */
if
(
!
hsh
)
{
hsh
=
hash_lookup
(
cls_method_hash_list
,
selname
);
}
/* If still not found, print out a warning. */
if
(
!
hsh
)
{
warning
(
"undeclared selector `%s'"
,
IDENTIFIER_POINTER
(
selname
));
}
}
if
(
flag_typed_selectors
)
return
build_typed_selector_reference
(
selname
,
0
);
else
...
...
@@ -5259,6 +5288,7 @@ lookup_method (mchain, method)
{
if
(
METHOD_SEL_NAME
(
mchain
)
==
key
)
return
mchain
;
mchain
=
TREE_CHAIN
(
mchain
);
}
return
NULL_TREE
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment