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

function without prototype warnings #38

Closed
mbetel opened this issue Apr 4, 2023 · 9 comments
Closed

function without prototype warnings #38

mbetel opened this issue Apr 4, 2023 · 9 comments

Comments

@mbetel
Copy link

mbetel commented Apr 4, 2023

When compiling with newest apple clang (14.0.3) I now get the warning :
warning: a function declaration without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
on zlib/adler32.c, zlib/crc32.c, zlib/inffast.c, zlib/inflate.c, zlib/inftrees.c, zlib/zutil.c.

My guess is the embedded zlib will need .h files in the near future? , but I am no C expert...

@gen2brain
Copy link
Owner

It is just a warning, you can ignore it, or configure CFLAGS with something like -Wno-deprecated-non-prototype. I guess that -std=c99 should be used/defined somewhere instead, C2x, as I understand, would become c23. Not all projects will magically support c23 overnight.

@gen2brain
Copy link
Owner

And I see that there is already -std=gnu99, I guess clang doesn't support that, can you check?

gen2brain added a commit that referenced this issue Apr 4, 2023
@gen2brain
Copy link
Owner

Changed to c99 in 4d5d46a, can you check with the latest code?

@jamelt
Copy link
Contributor

jamelt commented May 31, 2023

I just tried this out and it doesn't fix it.

jamelt pushed a commit to enterprizesoftware/go-unarr that referenced this issue May 31, 2023
…arnings to suppress warnings that library users are unlikely to fix or address.
jamelt added a commit to enterprizesoftware/go-unarr that referenced this issue Jun 1, 2023
…t emit warnings to suppress warnings that library users are unlikely to fix or address."

This reverts commit e3672cc.
jamelt added a commit to enterprizesoftware/go-unarr that referenced this issue Jun 1, 2023
gen2brain added a commit that referenced this issue Jun 2, 2023
Fixes #38 - added CGO_CFLAGS to specific targets that emit w…
@jamelt
Copy link
Contributor

jamelt commented Jun 5, 2023

@gen2brain We might need to back that change out. Apparently, it works fine on M1/2 Macs, but it can cause build errors on the x86 Macs.

@gen2brain
Copy link
Owner

These were just warnings, not build errors. So now it warns that such suppression options do not exist. I do not see how that is related to M1/2 (i.e. architecture), it should be associated with the Clang version, no?

@gen2brain gen2brain reopened this Jun 5, 2023
@jamelt
Copy link
Contributor

jamelt commented Jun 6, 2023

You're right, the issue at hand is linked to the Clang version. To address this in my team project, I created a script in the Makefile that checks if the flags are supported before exporting them. However, I'm unsure if the same can be done for the cgo flags within the package.

CLANG_EXISTS := $(shell command -v clang 2> /dev/null)
FLAG_SUPPORTED := $(shell echo 'int main(){}' | clang -x c - -o /dev/null -Wno-typedef-redefinition -Wno-deprecated-non-prototype 2>&1 && echo YES)

ifdef CLANG_EXISTS
ifeq ($(FLAG_SUPPORTED),YES)
export CGO_CFLAGS := -Wno-typedef-redefinition -Wno-deprecated-non-prototype
endif
endif

all:
@echo $(CGO_CFLAGS)

I was concerned about the potential negative impact this could have on people currently.

@gen2brain
Copy link
Owner

Something like this should be possible, with predefined macros, if you can tell me the exact major versions that need to be checked.

#if defined(__clang__) && __clang_major__ >= 16
#cgo CFLAGS: -Wno-typedef-redefinition -Wno-deprecated-non-prototype
#endif

gen2brain added a commit that referenced this issue Oct 16, 2023
@gen2brain
Copy link
Owner

This should be fixed now, with the Zlib update.

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