Bug 135539

Summary: cproto creates output with illegal syntax
Product: Red Hat Enterprise Linux 3 Reporter: Dr. Gabriella Schmidt <gabriella.schmidt>
Component: cprotoAssignee: Jindrich Novy <jnovy>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0CC: pknirsch
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-10-17 06:04:27 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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.