<< Back to previous view

[PCC-385] function prototypes as arguments cannot take attributes Created: 13/Mar/12  Updated: 24/Mar/12

Status: Resolved
Project: pcc
Component/s: C frontend
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Iain Hibbert Assignee: Anders Magnusson
Resolution: Fixed Votes: 0
Environment: NetBSD/i386

File Attachments: File attr2.c    

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"

Comment by Iain Hibbert [ 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
Comment by Anders Magnusson [ 24/Mar/12 05:55 PM ]
Fixed now.
Generated at Mon Apr 23 03:54:39 CEST 2018 using JIRA Enterprise Edition, Version: 3.13.1-#333.