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
4c5cf0b2
Commit
4c5cf0b2
authored
10 years ago
by
Jason Merrill
Committed by
Jason Merrill
10 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* tree.c (handle_abi_tag_attribute): Diagnose invalid arguments.
From-SVN: r220356
parent
6f105c50
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
0 deletions
+53
-0
gcc/cp/ChangeLog
+4
-0
gcc/cp/tree.c
+44
-0
gcc/testsuite/g++.dg/abi/abi-tag13.C
+5
-0
No files found.
gcc/cp/ChangeLog
View file @
4c5cf0b2
2015-02-02 Jason Merrill <jason@redhat.com>
* tree.c (handle_abi_tag_attribute): Diagnose invalid arguments.
2015-01-30 Joseph Myers <joseph@codesourcery.com>
* class.c, except.c, parser.c, pt.c: All callers of fatal_error
...
...
This diff is collapsed.
Click to expand it.
gcc/cp/tree.c
View file @
4c5cf0b2
...
...
@@ -3501,6 +3501,50 @@ static tree
handle_abi_tag_attribute
(
tree
*
node
,
tree
name
,
tree
args
,
int
flags
,
bool
*
no_add_attrs
)
{
for
(
tree
arg
=
args
;
arg
;
arg
=
TREE_CHAIN
(
arg
))
{
tree
elt
=
TREE_VALUE
(
arg
);
if
(
TREE_CODE
(
elt
)
!=
STRING_CST
||
(
!
same_type_ignoring_top_level_qualifiers_p
(
strip_array_types
(
TREE_TYPE
(
elt
)),
char_type_node
)))
{
error
(
"arguments to the %qE attribute must be narrow string "
"literals"
,
name
);
goto
fail
;
}
const
char
*
begin
=
TREE_STRING_POINTER
(
elt
);
const
char
*
end
=
begin
+
TREE_STRING_LENGTH
(
elt
);
for
(
const
char
*
p
=
begin
;
p
!=
end
;
++
p
)
{
char
c
=
*
p
;
if
(
p
==
begin
)
{
if
(
!
ISALPHA
(
c
)
&&
c
!=
'_'
)
{
error
(
"arguments to the %qE attribute must contain valid "
"identifiers"
,
name
);
inform
(
input_location
,
"%<%c%> is not a valid first "
"character for an identifier"
,
c
);
goto
fail
;
}
}
else
if
(
p
==
end
-
1
)
gcc_assert
(
c
==
0
);
else
{
if
(
!
ISALNUM
(
c
)
&&
c
!=
'_'
)
{
error
(
"arguments to the %qE attribute must contain valid "
"identifiers"
,
name
);
inform
(
input_location
,
"%<%c%> is not a valid character "
"in an identifier"
,
c
);
goto
fail
;
}
}
}
}
if
(
TYPE_P
(
*
node
))
{
if
(
!
OVERLOAD_TYPE_P
(
*
node
))
...
...
This diff is collapsed.
Click to expand it.
gcc/testsuite/g++.dg/abi/abi-tag13.C
0 → 100644
View file @
4c5cf0b2
const
char
*
foo
=
"bar"
;
void
__attribute
((
abi_tag
(
foo
)))
f1
()
{}
// { dg-error "abi_tag" }
void
__attribute
((
abi_tag
(
L"foo"
)))
f2
();
// { dg-error "abi_tag" }
void
__attribute
((
abi_tag
(
"3foo"
)))
f3
();
// { dg-error "abi_tag" }
void
__attribute
((
abi_tag
(
1
)))
f5
();
// { dg-error "abi_tag" }
This diff is collapsed.
Click to expand it.
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