Bug 135539 - cproto creates output with illegal syntax
Summary: cproto creates output with illegal syntax
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: cproto
Version: 3.0
Hardware: i686
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jindrich Novy
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-10-13 11:40 UTC by Dr. Gabriella Schmidt
Modified: 2013-07-02 23:02 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-10-17 06:04:27 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Dr. Gabriella Schmidt 2004-10-13 11:40:30 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.2)
Gecko/20040803

Description of problem:
cproto creates output which produces during compilation an error

Version-Release number of selected component (if applicable):
cproto-4.6-16

How reproducible:
Always

Steps to Reproduce:
1. Take the following code:

#include <stdio.h>		/* unix header */
#include <stdlib.h>

int	BacsGlobalErrorCode;
char	BacsGlobalErrorMessage[BUFSIZ];

const char *BacsGetErrorMsg (void)	/* return error message	       */
{
  switch (BacsGlobalErrorCode)
  {
  case 1:
  case 2:
  case 3:   return (BacsGlobalErrorMessage);

  default:
    return ("unknown");
  }
}

2. execute cproto Test.c > Test.h

3. Compile together with the file:
#include <stdio.h>              /* unix header */
#include <stdlib.h>
 
#include "Test.h"
 
int main(int argc,char **argv)
{
   printf("%s\n",BacsGetErrorMsg);
   return 0;
}

4. compile with:  cc -o Test main.c Test.c

5 resulting error:

In file included from main.c:4:
Test.h:2: function `BacsGetErrorMsg' is initialized like a variable
Test.h:2: invalid initializer
Test.h:2: (near initialization for `BacsGetErrorMsg')

    

Actual Results:  Test.h is:
/* Test.c */
const char *BacsGetErrorMsg(void) = {0};


Expected Results:  Test.h should look like:
/* Test.c */
const char *BacsGetErrorMsg(void);


Additional info:

Comment 1 Jindrich Novy 2004-10-13 15:37:16 UTC
Gunter, I reproduced this bug with cproto-4.6-17. This strange fashion
of prototype declaration is fixed in cproto-4.7c-1 (first occured in
FC2). I'll keep you informed about cproto fixes in RHEL3.

Jindrich

Comment 2 Jindrich Novy 2004-10-13 15:39:00 UTC
I forgot to thank you for the bug report!

Comment 3 Jindrich Novy 2004-10-17 06:04:27 UTC
Gunter, this is now fixed rawhide in cproto-4.7c-3.


Note You need to log in before you can comment on or make changes to this bug.