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

fix some warnings #13909

Merged
merged 2 commits into from May 13, 2024
Merged

fix some warnings #13909

merged 2 commits into from May 13, 2024

Conversation

ppphp
Copy link
Contributor

@ppphp ppphp commented May 9, 2024

a cmake string quotes
a float mark
a character replacement

@github-actions github-actions bot added the WB Sketcher Related to the Sketcher Workbench label May 9, 2024
@ppphp ppphp marked this pull request as ready for review May 9, 2024 05:02
@3x380V
Copy link
Contributor

3x380V commented May 9, 2024

Why is '°' sign replaced with text? The patch seems as a bunch of random changes without any explanation. Care to explain them?

@ppphp
Copy link
Contributor Author

ppphp commented May 9, 2024

Why is '°' sign replaced with text? The patch seems as a bunch of random changes without any explanation. Care to explain them?

It fixes some warning issues on msvc.

Degree sign shows tofu on my system and bump warning
[build] D:\FreeCAD\src\Mod\Sketcher\Gui\SnapManager.h(1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
It means "The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss"

points is a std::vector<Base::Vector3f> but we push int without suffix into it. It will bump warning
[build] C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\xmemory(677): warning C4244: “参数”: 从“_Ty”转换到“float_type”,可能丢失数据

The string quote prevents from string REPLACE argument number problem(my versoin is cmake 3.26.0 rc6). It will fail when I make a clean and rebuild.

@3x380V
Copy link
Contributor

3x380V commented May 9, 2024

Huh... I though Microsoft abandoned whole concept of code pages decades ago and they are now used by legacy apps only.

Btw, why does compiler does not complain to other assignments to Base::Vector3f in the very same file? Anyway, these are perfectly legal.

+1 to cMake change.

@wwmayer
Copy link
Contributor

wwmayer commented May 9, 2024

points is a std::vectorBase::Vector3f but we push int without suffix into it. It will bump warning

The suffix should be F then, not f. Otherwise clang-tidy will raise a warning: readability-uppercase-literal-suffix

@chennes
Copy link
Member

chennes commented May 9, 2024

It means "The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss"

I'd argue that the file's encoding is wrong, not that the degree symbol should be replaced -- I don't think we should have any windows-1252 files in our repo.

@3x380V
Copy link
Contributor

3x380V commented May 9, 2024

That is local issue, git has no concept of encoding unless something like UTF-16 is used in which case it detects it as a binary blob.

@ppphp
Copy link
Contributor Author

ppphp commented May 9, 2024

It means "The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss"

I'd argue that the file's encoding is wrong, not that the degree symbol should be replaced -- I don't think we should have any windows-1252 files in our repo.

That is local issue, git has no concept of encoding unless something like UTF-16 is used in which case it detects it as a binary blob.

It is a daily editor problem in windows. Visual Studio always saves files into a lot of local encodings except utf-8 depending on system locale config, but the other editors always open file with default encoding utf-8.

One solution is only using ascii in code, which I think is the best solution, so I change the sign to degree. Another solution is adding compile flag utf-8, but it can only mute warnings but still shows tofu. Another solution is that one encoding compromises.

I would preserve the encoding warning, because there is no universal rule for the problem in FreeCAD.

@3x380V
Copy link
Contributor

3x380V commented May 10, 2024

That sounds reasonable. UTF-8 is standard for at least a decade now, so it is probably not worth doing anything on behalf just one IDE of many.
Besides, if you split your changes in two commits with appropriate commit messages, you are ready to go.
(note, that many people are commiting unrelated changes in single commit, but I consider such a commit history hard to read and understand. Choice is yours, after all I'm not the one merging PRs :))

@adrianinsaval adrianinsaval merged commit 4cd8b2a into FreeCAD:main May 13, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WB Sketcher Related to the Sketcher Workbench
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants