c-for-go: Invalid type specifier typedef struct

I should probably prefix this by mentioning that I haven’t done any C/C++ development in 5 years. I probably have much bigger issues here than this error, but any input will be appreciated.

The parser is complaining about this definition:

typedef struct {
    C4ErrorDomain domain;
    int32_t code;
    int32_t internal_info;
} C4Error;

Config file (trying to start small):

--- 
GENERATOR: 
  PackageName: golite
  PackageDescription: "coming soon"
  PackageLicense: "THE AUTOGENERATED LICENSE. ALL THE RIGHTS ARE RESERVED BY ROBOTS."
  FlagGroups:
    - {name: LDFLAGS, flags: [""]}
  Includes:
    - include/c4.h
  SysIncludes:
    - /usr/local/lib

PARSER:
  Defines:
    __STDC_HOSTED__: null

  IncludePaths:
    - ./include
    - /System/Library/Frameworks/Kernel.framework/Versions/A/Headers

  SourcesPaths:
    - include/c4.h

TRANSLATOR: 
  ConstRules: 
    defines: expand
    enum: expand

When I run:

c-for-go -out .. go-lite.yml 

I get errors:

⠋include/c4Base.h:184:9: invalid type specifier
include/c4Base.h:207:13: invalid type specifier
include/c4Base.h:294:28: redeclaration of C4LogDomain 'typedef struct c4LogDomain*' with no linkage, previous declaration at include/c4Base.h:294:28 'typedef struct c4LogDomain*'
include/c4Base.h:297:14: redeclaration of C4LogCallback 'typedef void(*)(struct c4LogDomain*,char,const char*,void*)' with no linkage, previous declaration at include/c4Base.h:297:14 'typedef void(*)(struct c4LogDomain*,char,const char*,void*)'
include/c4BlobStore.h:11:10: include file not found: stdio.h
include/c4Base.h:184:9: invalid type specifier
include/c4Base.h:207:13: invalid type specifier
include/c4Base.h:294:28: redeclaration of C4LogDomain 'typedef struct c4LogDomain*' with no linkage, previous declaration at include/c4Base.h:294:28 'typedef struct c4LogDomain*'
include/c4Base.h:297:14: redeclaration of C4LogCallback 'typedef void(*)(struct c4LogDomain*,char,const char*,void*)' with no linkage, previous declaration at include/c4Base.h:297:14 'typedef void(*)(struct c4LogDomain*,char,const char*,void*)'
include/c4Database.h:53:13: invalid type specifier
too many errors

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (8 by maintainers)

Commits related to this issue

Most upvoted comments

@cznic certainly no, I allowed only what was preset at the moment, years ago:

	return cc.Parse(predefined, cfg.SourcesPaths, model,
		cc.SysIncludePaths(cfg.IncludePaths),
		cc.EnableAnonymousStructFields(),
		cc.EnableAsm(),
		cc.EnableAlternateKeywords(),
		cc.EnableIncludeNext(),
		cc.EnableNoreturn(),
		cc.EnableEmptyDeclarations(),
		cc.EnableWideEnumValues(),
		cc.EnableWideBitFieldTypes(),
	)

I will try to enable everything.