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

msvc build warning #520

Closed
reid-p opened this issue May 28, 2020 · 8 comments
Closed

msvc build warning #520

reid-p opened this issue May 28, 2020 · 8 comments

Comments

@reid-p
Copy link

reid-p commented May 28, 2020

The recent commit "Win: move to safe version of sscanf" is resulting in a build warning for me.
Specifically

xml.c(153,25): error C2220: the following warning is treated as an error xml.c(153,25): warning C4477: 'sscanf_s' : format string '%c' requires an argument of type 'unsigned int', but variadic argument 2 has type 'size_t' xml.c(153,25): message : this argument is used as a buffer size xml.c(153,25): warning C4477: 'sscanf_s' : format string '%c' requires an argument of type 'unsigned int', but variadic argument 4 has type 'size_t' xml.c(153,25): message : this argument is used as a buffer size xml.c(165,25): warning C4477: 'sscanf_s' : format string '%c' requires an argument of type 'unsigned int', but variadic argument 2 has type 'size_t' xml.c(165,25): message : this argument is used as a buffer size xml.c(165,25): warning C4477: 'sscanf_s' : format string '%c' requires an argument of type 'unsigned int', but variadic argument 4 has type 'size_t' xml.c(165,25): message : this argument is used as a buffer size

Casting the sizeof params to int solves the problem. ie:
&e, (unsigned int)sizeof(e), &s, (unsigned int)sizeof(s),

@tfcollins
Copy link
Contributor

Can you try a more recent commit? I believe this was already fixed here 282c10d

@reid-p
Copy link
Author

reid-p commented May 28, 2020

On at commit : 831d858 Merge pull request #515 from analogdevicesinc/rgetz-coverity-fix-resource-leak

I'm doing a 64 bit build if that helps.

@tfcollins
Copy link
Contributor

Slightly confused on your last reply. Are you using 831d858? and what compiler are you using?

-Travis

@rgetz
Copy link
Contributor

rgetz commented May 28, 2020

yeah, we compile without warnings on master tip (32-bit and 64) on CI, or it would error.

Check Win Cmake flags at:

https://github.com/analogdevicesinc/libiio/blob/master/CMakeLists.txt#L62-L65

and

https://github.com/analogdevicesinc/libiio/blob/master/CMakeLists.txt#L161-L164

log at:
https://ci.appveyor.com/project/analogdevicesinc/libiio/branch/master

-- The C compiler identification is MSVC 18.0.40629.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe

<snip>

-- The C compiler identification is MSVC 18.0.40629.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/x86_amd64/cl.exe

@reid-p
Copy link
Author

reid-p commented May 28, 2020

Sorry, Yes using everything up to commit 831d858.
Compiler is:
Microsoft (R) C/C++ Optimizing Compiler Version 19.25.28614 for x64

rgetz added a commit that referenced this issue May 29, 2020
try to replicate #520

Signed-off-by: Robin Getz <[email protected]>
rgetz added a commit that referenced this issue May 29, 2020
try to replicate #520

Signed-off-by: Robin Getz <[email protected]>
rgetz added a commit that referenced this issue May 29, 2020
try to replicate #520

Signed-off-by: Robin Getz <[email protected]>
rgetz added a commit that referenced this issue May 29, 2020
try to replicate #520

Signed-off-by: Robin Getz <[email protected]>
rgetz added a commit that referenced this issue May 29, 2020
try to replicate #520

Signed-off-by: Robin Getz <[email protected]>
rgetz added a commit that referenced this issue May 29, 2020
try to replicate #520

Signed-off-by: Robin Getz <[email protected]>
rgetz added a commit that referenced this issue May 29, 2020
try to replicate #520

Signed-off-by: Robin Getz <[email protected]>
rgetz added a commit that referenced this issue May 29, 2020
try to replicate #520

Signed-off-by: Robin Getz <[email protected]>
rgetz added a commit that referenced this issue May 29, 2020
try to replicate #520

Signed-off-by: Robin Getz <[email protected]>
rgetz added a commit that referenced this issue May 29, 2020
try to replicate #520

Signed-off-by: Robin Getz <[email protected]>
@rgetz
Copy link
Contributor

rgetz commented May 29, 2020

Ok - I can replicate things on AppVeyor - and will merge fixes when everything is resolved. Thanks for the bug report.

Just as a question - what version of MSVC does it make sense to release binaries on? oldest? or latest? I think today its 2015

rgetz added a commit that referenced this issue May 29, 2020
try to replicate #520

Signed-off-by: Robin Getz <[email protected]>
rgetz added a commit that referenced this issue May 29, 2020
try to replicate #520

Signed-off-by: Robin Getz <[email protected]>
rgetz added a commit that referenced this issue May 29, 2020
try to replicate #520

Signed-off-by: Robin Getz <[email protected]>
rgetz added a commit that referenced this issue May 29, 2020
try to replicate #520

Signed-off-by: Robin Getz <[email protected]>
rgetz added a commit that referenced this issue May 29, 2020
try to replicate #520

Signed-off-by: Robin Getz <[email protected]>
rgetz added a commit that referenced this issue May 30, 2020
try to replicate #520

Signed-off-by: Robin Getz <[email protected]>
rgetz added a commit that referenced this issue May 30, 2020
try to replicate #520

Signed-off-by: Robin Getz <[email protected]>
rgetz added a commit that referenced this issue May 30, 2020
try to replicate #520

Signed-off-by: Robin Getz <[email protected]>
@rgetz
Copy link
Contributor

rgetz commented May 31, 2020

Ok - this will be fixed on #523 - if you still see issues - let us know. Closing this for now.

@rgetz rgetz closed this as completed May 31, 2020
@reid-p
Copy link
Author

reid-p commented Jun 1, 2020

Just as a question - what version of MSVC does it make sense to release binaries on? oldest? or latest? I think today its 2015

Tested the fix and all good. thanks.
I'm tend to use fairly recent MSVC, 2019 (15.5), to get the latest c++ support so I'd suggest latest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants