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

posix: add missing HAVE_ALLOCA_H definition, fixes #272 #308

Merged
merged 1 commit into from
Jul 16, 2024

Conversation

sbraz
Copy link
Contributor

@sbraz sbraz commented Jul 14, 2024

Hi,
Without this, the build fails with:

/var/tmp/portage/net-nntp/nzbget-24.1/work/nzbget-24.1/lib/regex/regex.c: In function ‘set_regs’:
/var/tmp/portage/net-nntp/nzbget-24.1/work/nzbget-24.1/lib/regex/regex.c:7701:39: error: implicit declaration of function ‘alloca’; did you mean ‘calloc’? [-Wimplicit-function-declaration]                        7701 |         prev_idx_match = (regmatch_t*)alloca(nmatch * sizeof(regmatch_t));
      |                                       ^~~~~~
      |                                       calloc

Description

This fixes #272.

Lib changes

None.

Testing

This fixes the build on my machine.

@sbraz sbraz changed the title posix: add missing HAVE_ALLOCA_H definition, fixe #272 posix: add missing HAVE_ALLOCA_H definition, fixes #272 Jul 14, 2024
@dnzbk dnzbk self-requested a review July 15, 2024 04:51
@dnzbk
Copy link
Collaborator

dnzbk commented Jul 15, 2024

@sbraz

Thank you but move your changes after this line, please and include(CheckIncludeFile) won't be needed.
regex was vendored in this commit due to an issue with building the application on Windows and I think it wasn't a good solution. I'll try to remove it later.

@sbraz sbraz force-pushed the fix_allocah branch 2 times, most recently from e19fd1c to 0f2cda1 Compare July 15, 2024 11:20
@sbraz
Copy link
Contributor Author

sbraz commented Jul 15, 2024

Is this better now? I don't really understand how the other check_include_file calls work, they set a HAVE_* variable but never pass it to the compiler?

@dnzbk
Copy link
Collaborator

dnzbk commented Jul 15, 2024

Is this better now?

Yes, better, thanks.

I don't really understand how the other check_include_file calls work, they set a HAVE_* variable but never pass it to the compiler?

For preprocessor definitions we use check_include_file and a file template.
Then the CMake configure_file command does the trick.

If you put HAVE_ALLOCA_H to config.h.in in the same way as the other definitions that would be the best solution.

Without this, the build fails with:
```
/var/tmp/portage/net-nntp/nzbget-24.1/work/nzbget-24.1/lib/regex/regex.c: In function ‘set_regs’:
/var/tmp/portage/net-nntp/nzbget-24.1/work/nzbget-24.1/lib/regex/regex.c:7701:39: error: implicit declaration of function ‘alloca’; did you mean ‘calloc’? [-Wimplicit-function-declaration]                        7701 |         prev_idx_match = (regmatch_t*)alloca(nmatch * sizeof(regmatch_t));
      |                                       ^~~~~~
      |                                       calloc
```
@sbraz
Copy link
Contributor Author

sbraz commented Jul 15, 2024

Thanks, this makes more sense to me now :) I still don't really see when #cmakedefine HAVE_ALLOCA_H @HAVE_ALLOCA_H@ is expanded but it's no big deal. I think the latest commit follows the existing style as requested.

@dnzbk dnzbk merged commit 412d9e5 into nzbgetcom:develop Jul 16, 2024
1 check passed
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.

regex.c:7701:39: warning: implicit declaration of function ‘alloca’ with v24.0
2 participants