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

[0.3.3] src/axc.c compile warnings that could be of interest #21

Closed
hartwork opened this issue Dec 5, 2020 · 6 comments · Fixed by #29
Closed

[0.3.3] src/axc.c compile warnings that could be of interest #21

hartwork opened this issue Dec 5, 2020 · 6 comments · Fixed by #29

Comments

@hartwork
Copy link
Contributor

hartwork commented Dec 5, 2020

src/axc.c:34:16: warning: struct has no members [-Wpedantic]
   34 | typedef struct axc_mutexes {
      |                ^~~~~~~~~~~
src/axc.c: In function ‘axc_pre_key_message_process’:
src/axc.c:1074:12: warning: unused variable ‘pre_key_id’ [-Wunused-variable]
 1074 |   uint32_t pre_key_id = 0;
      |            ^~~~~~~~~~
@gkdr
Copy link
Owner

gkdr commented Dec 5, 2020

thanks for the issue!

  • iirc, the first one is due to how i disable threading support. i implemented it using pthread (which causes problems when compiling for windows) and libpurple (probably the only thing this is used for?) is single threaded anyway. so i just remove the code using macros, resulting (among ohter things) in this warning. do you have a hint for me for a better solution to this problem?
  • the second one was noticed in Adding ability to build as a shared library #17 and if i understood it correctly, @henry-nicolas will file a PR for this. not sure why i missed that when removing the usage of the internal API that was used for.

@hartwork
Copy link
Contributor Author

hartwork commented Dec 5, 2020

For former: Do you think that the whole axc_mutexes struct could be hid away by the pre-processor or is there some reason why it has to exist when e.g. compiling for Windows?

@Neustradamus
Copy link

Linked to:

@gkdr
Copy link
Owner

gkdr commented Dec 8, 2020

@hartwork i assumed that i only hid these parts for a reason, but now that you ask i'm not sure the reason wasn't just that it's the quickest solution. i glanced over it and it seems that by hiding some more code via the preprocessor, i could in fact completely hide this feature from the compiler.

however, it still bugs me: is that really how feature flags are implemented?

@hartwork
Copy link
Contributor Author

hartwork commented Dec 8, 2020

@hartwork i assumed that i only hid these parts for a reason, but now that you ask i'm not sure the reason wasn't just that it's the quickest solution. i glanced over it and it seems that by hiding some more code via the preprocessor, i could in fact completely hide this feature from the compiler.

Cool!

however, it still bugs me: is that really how feature flags are implemented?

I'm not sure. Adding a dummy field to avoid an empty struct might be an alternative hack, but if the whole struct can disappear, maybe it's not even bad.

@hartwork
Copy link
Contributor Author

@gkdr I thought about it again: keeping -Wpedantic and having it clean has some value in my book, so I made pull request #29 now to get to that state.

hartwork added a commit to hartwork/axc that referenced this issue Sep 13, 2021
@gkdr gkdr closed this as completed in 4c2b6a6 Jan 29, 2022
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 a pull request may close this issue.

3 participants