target: support spaces in target attribute.
PR target/102374 gcc/ChangeLog: * config/i386/i386-options.c (ix86_valid_target_attribute_inner_p): Strip whitespaces. * system.h (strip_whilespaces): New function. gcc/testsuite/ChangeLog: * gcc.target/i386/pr102374.c: New test.
This commit is contained in:
parent
38f6ee6bfc
commit
df592811f9
3 changed files with 26 additions and 0 deletions
|
@ -1146,6 +1146,8 @@ ix86_valid_target_attribute_inner_p (tree fndecl, tree args, char *p_strings[],
|
|||
next_optstr = NULL;
|
||||
}
|
||||
|
||||
p = strip_whitespaces (p, &len);
|
||||
|
||||
/* Recognize no-xxx. */
|
||||
if (len > 3 && p[0] == 'n' && p[1] == 'o' && p[2] == '-')
|
||||
{
|
||||
|
|
21
gcc/system.h
21
gcc/system.h
|
@ -1305,4 +1305,25 @@ startswith (const char *str, const char *prefix)
|
|||
return strncmp (str, prefix, strlen (prefix)) == 0;
|
||||
}
|
||||
|
||||
/* Strip white spaces from STRING with LEN length.
|
||||
A stripped string is returned and LEN is updated accordingly. */
|
||||
|
||||
static inline char *
|
||||
strip_whitespaces (char *string, size_t *len)
|
||||
{
|
||||
while (string[0] == ' ' || string[0] == '\t')
|
||||
{
|
||||
--(*len);
|
||||
++string;
|
||||
}
|
||||
|
||||
while (string[*len - 1] == ' ' || string[*len - 1] == '\t')
|
||||
{
|
||||
string[*len - 1] = '\0';
|
||||
--(*len);
|
||||
}
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
#endif /* ! GCC_SYSTEM_H */
|
||||
|
|
3
gcc/testsuite/gcc.target/i386/pr102374.c
Normal file
3
gcc/testsuite/gcc.target/i386/pr102374.c
Normal file
|
@ -0,0 +1,3 @@
|
|||
/* PR target/102374 */
|
||||
|
||||
void calculate_sse(void) __attribute__ ((__target__ (" no-avx, sse2 ")));
|
Loading…
Add table
Reference in a new issue