v icon indicating copy to clipboard operation
v copied to clipboard

Global variable naming conflicts with stdlib.h's function

Open ChAoSUnItY opened this issue 3 years ago • 2 comments

OS: windows, Microsoft Windows 11 Home v22000 64-bit Processor: 20 cpus, 64bit, little endian, 12th Gen Intel(R) Core(TM) i7-12700 CC version: Error: exec failed (CreateProcess) with code 2: 系統找不到指定的檔案。 cmd: cc --version

getwd: C:\Users\chaos\projects\v_jvm vmodules: C:\Users\chaos.vmodules vroot: C:\Users\chaos\projects\v vexe: C:\Users\chaos\projects\v\v.exe vexe mtime: 2022-08-26 07:08:14 is vroot writable: true is vmodules writable: true V full version: V 0.3.0 40c0a8c.3ab0381

Git version: git version 2.35.1.windows.2 Git vroot status: weekly.2022.34-37-g3ab0381a .git/config present: true thirdparty/tcc status: thirdparty-windows-amd64 125e21e2

What did you do? v -enable-globals run global_var.v

global_var.v

__global (
	dup = 1
	dup2 = 2
)

What did you expect to see? No error

What did you see instead?

==================
C:/Users/chaos/AppData/Local/Temp/v_0/global_var.3709138015868145043.tmp.c:469: warning: WINVER redefined
C:/Users/chaos/AppData/Local/Temp/v_0/global_var.3709138015868145043.tmp.c:2023: error: incompatible types for redefinition of 'dup'
...
==================
(Use `v -cg` to print the entire error message)

builder error:
==================

Possible fix: discord discussion about this issue is here

@alehander92 suggest that prepending global variable with prefix _v_g_ is the easiest workaround.

ChAoSUnItY avatar Aug 26 '22 04:08 ChAoSUnItY

I can work on this if no body wants too

Delta456 avatar Aug 26 '22 04:08 Delta456

Work on this may have to be postponed, till the parallel C compilation changeset is merged. @medvednikov what do you think?

spytheman avatar Aug 26 '22 07:08 spytheman