Issue Details (XML | Word | Printable)

Key: PCC-385
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Anders Magnusson
Reporter: Iain Hibbert
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
pcc

function prototypes as arguments cannot take attributes

Created: 13/Mar/12 08:43 AM   Updated: 24/Mar/12 05:55 PM
Component/s: C frontend
Affects Version/s: None
Fix Version/s: None

File Attachments: 1. File attr2.c (0.8 kB)

Environment: NetBSD/i386


 Description  « Hide
assigning an attribute to a function argument which is a prototype fails with a syntax error, as illustrated by the following code fragment

int foo(char *, ...) __attribute__ (( __format__ (__printf__, 1, 2) ));

void bar(int (*)(char *, ...) __attribute__ (( __format__ (__printf__, 1, 2) )) );

the second line fails with "syntax error"

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Iain Hibbert added a comment - 17/Mar/12 07:45 AM
Further to this, the syntax error only manifests during a declaration, when

  - the attribute is listed after the parameter
  - the parameter is a function prototype
  - the parameter does not have an identifier

see the attr2.c file attached for a fuller example, which fails at the marked lines

Iain Hibbert made changes - 17/Mar/12 07:45 AM
Field Original Value New Value
Attachment attr2.c [ 10221 ]
Anders Magnusson made changes - 24/Mar/12 05:55 PM
Assignee Anders Magnusson [ ragge ]
Anders Magnusson added a comment - 24/Mar/12 05:55 PM
Fixed now.

Anders Magnusson made changes - 24/Mar/12 05:55 PM
Status Open [ 1 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]