Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated c code is not compile with the vcc cl.exe before 2012 after v0.19 #10352

Closed
slangmgh opened this issue Jan 18, 2019 · 1 comment
Closed

Comments

@slangmgh
Copy link
Contributor

After the v0.19, the module init function contains code "{TFrame FR_; FR_.len = 0;}" before c variable define, and this is not allowed with classical c compiler.

This is code generated after v0.19:

N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void) {
{
	TFrame FR_; FR_.len = 0;
}
	int T1_;
	int T2_;
	int T3_;
nimRegisterThreadLocalMarker(TM_Q5wkpxktOdTGvlSRo9bzt9aw_17);
	genericReset((void*)(&strDesc_D0UzA4zsDu5tgpJQ9a9clXPg), (&NTI_TuG1vdYwChKtx4TOkRnAjw_));
	strDesc_D0UzA4zsDu5tgpJQ9a9clXPg.size = ((NI) 4);
	strDesc_D0UzA4zsDu5tgpJQ9a9clXPg.kind = ((tyEnum_TNimKind_jIBKr1ejBgsfM33Kxw4j7A) 28);
	strDesc_D0UzA4zsDu5tgpJQ9a9clXPg.flags = 2;
	T1_ = (int)0;
	T1_ = _fileno(stdin);
	_setmode(T1_, _O_BINARY);
	T2_ = (int)0;
	T2_ = _fileno(stdout);
	_setmode(T2_, _O_BINARY);
	T3_ = (int)0;
	T3_ = _fileno(stderr);
	_setmode(T3_, _O_BINARY);
	initAllocator_IZ2oOmqdsYQ7vixQGKSDcAsystem();
	initStackBottom();
	initGC_njssp69aa7hvxte9bJ8uuDcg();
	registerSignalHandler_njssp69aa7hvxte9bJ8uuDcg_2();
}

And this is the code generate before v0.19

N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void) {
	int T1_;
	int T2_;
	int T3_;
nimRegisterThreadLocalMarker(TM_Q5wkpxktOdTGvlSRo9bzt9aw_17);
	genericReset((void*)(&strDesc_D0UzA4zsDu5tgpJQ9a9clXPg), (&NTI_qQQlSworN6w6Qnxtmq0s5Q_));
	strDesc_D0UzA4zsDu5tgpJQ9a9clXPg.size = ((NI) 4);
	strDesc_D0UzA4zsDu5tgpJQ9a9clXPg.kind = ((tyEnum_TNimKind_jIBKr1ejBgsfM33Kxw4j7A) 28);
	strDesc_D0UzA4zsDu5tgpJQ9a9clXPg.flags = 2;
	T1_ = (int)0;
	T1_ = _fileno(stdin);
	_setmode(T1_, _O_BINARY);
	T2_ = (int)0;
	T2_ = _fileno(stdout);
	_setmode(T2_, _O_BINARY);
	T3_ = (int)0;
	T3_ = _fileno(stderr);
	_setmode(T3_, _O_BINARY);
	initAllocator_IZ2oOmqdsYQ7vixQGKSDcAsystem();
	initStackBottom();
	initGC_njssp69aa7hvxte9bJ8uuDcg();
	registerSignalHandler_njssp69aa7hvxte9bJ8uuDcg_2();
}
@slangmgh
Copy link
Contributor Author

In the cgen.nim/genInitCode.
Should add "{" "}" around the following generated code.

LemonBoy added a commit to LemonBoy/Nim that referenced this issue Jan 22, 2019
Local variables are declared before anything else.

Fixes nim-lang#10352
slangmgh added a commit to slangmgh/Nim that referenced this issue Jan 22, 2019
narimiran pushed a commit that referenced this issue Jan 22, 2019
Local variables are declared before anything else.

Fixes #10352
ThomasTJdev pushed a commit to ThomasTJdev/Nim that referenced this issue Jan 27, 2019
Local variables are declared before anything else.

Fixes nim-lang#10352
Araq pushed a commit that referenced this issue Jan 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants