Bug 135539 - cproto creates output with illegal syntax
cproto creates output with illegal syntax
Status: CLOSED RAWHIDE
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: cproto (Show other bugs)
3.0
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Jindrich Novy
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-10-13 07:40 EDT by Dr. Gabriella Schmidt
Modified: 2013-07-02 19:02 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-10-17 02:04:27 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Dr. Gabriella Schmidt 2004-10-13 07:40:30 EDT
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 11:37:16 EDT
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 11:39:00 EDT
I forgot to thank you for the bug report!
Comment 3 Jindrich Novy 2004-10-17 02:04:27 EDT
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.