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

Resolved multiple warnings on Apple targets. #1145

Merged
merged 7 commits into from
Aug 30, 2024

Conversation

MAJigsaw77
Copy link
Contributor

  • Replaced sprintf with snprintf because sprintf is deprecated.
  • Added -Wno-unused-command-line-argument to MacOS toolchain to remove warnings related to unused commands, for example clang: warning: argument unused during compilation: '-stdlib=libc++' [-Wunused-command-line-argument].

@tobil4sk
Copy link
Member

Added -Wno-unused-command-line-argument to MacOS toolchain to remove warnings related to unused commands, for example clang: warning: argument unused during compilation: '-stdlib=libc++' [-Wunused-command-line-argument].

It would be better to solve the root cause of this warning, which is that -stdlib=libstdc++ should not be passed in when compiling regular C files. It is possible to use cppflag and mmflag tags, e.g.:

<cppflag value="-stdlib=libstdc++" if="FORCE_LIBGCC" />

@MAJigsaw77
Copy link
Contributor Author

@tobil4sk is it fine now?

@tobil4sk
Copy link
Member

@MAJigsaw77 Thanks, the mac-toolchain.xml changes look good to me now

@MAJigsaw77
Copy link
Contributor Author

@tobil4sk Are the changes from iOS and tvOS toolchains fine as well?

@MAJigsaw77
Copy link
Contributor Author

@tobil4sk Are the changes from iOS and tvOS toolchains fine as well?

Tested them, they work flawlessly

@tobil4sk
Copy link
Member

@tobil4sk Are the changes from iOS and tvOS toolchains fine as well?

Thanks, they look good to me too

@Simn Simn merged commit 08f88ff into HaxeFoundation:master Aug 30, 2024
120 checks passed
@@ -217,7 +217,7 @@ class PointerData : public hx::Object
String toString()
{
char buf[100];
sprintf(buf,"Pointer(%p)", mValue);
snprintf(buf,sizeof(buf),"Pointer(%p)", mValue);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this correct? sizeof() returns the size of a single char, it doesn't return 100.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, it looks like in this case it does work properly since char buf[] is stack allocated. Is it also working correctly in mysql/my_api.cpp?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would seem like this is also the case there:

char last_error[MAX_ERR_SIZE];

Should all be good then.

@MAJigsaw77 MAJigsaw77 deleted the patch-1 branch August 30, 2024 08:29
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

Successfully merging this pull request may close these issues.

4 participants