Bug 135539 - cproto creates output with illegal syntax
cproto creates output with illegal syntax
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: cproto (Show other bugs)
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Jindrich Novy
Depends On:
  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:
Last Closed: 2004-10-17 02:04:27 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
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)

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

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

How reproducible:

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);

    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)
   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.

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.