Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Avoid macro redefined warning#3861

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
catap wants to merge1 commit intoscala-native:main
base:main
Choose a base branch
Loading
fromcatap:undef
Draft

Conversation

catap
Copy link
Contributor

We redefines some macros on FreeBSD and OpenBSD, and it trigers some warning which may lead to failure when-Werror is used.

We redefines some macros on FreeBSD and OpenBSD, and it trigers somewarning which may lead to failure when `-Werror` is used.
Comment on lines +30 to 33
#ifdef _XOPEN_VERSION
#undef _XOPEN_VERSION
#endif
#define _XOPEN_VERSION 0
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess it would be better to keep original macro

Suggested change
#ifdef_XOPEN_VERSION
#undef _XOPEN_VERSION
#endif
#define_XOPEN_VERSION 0
#ifndef_XOPEN_VERSION
#define_XOPEN_VERSION 0
#endif

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Not sure, because only part of constant are missed and all of them is switched of.

Let me ping@LeeTibbert as well.

@ekrich
Copy link
Member

I think there was a discussion about this and we concluded that it was getting ugly so this second approach on top was followed. Perhaps a better approach to using#undef and all this stuff on top is to create a macro to replace the following where needed:

#ifdef_PC_ALLOC_SIZE_MINreturn_PC_ALLOC_SIZE_MIN;#elsereturn0;#endif

You know, when macros get bad make another :-)

@catap
Copy link
ContributorAuthor

Ok, I'll take care of this in different way.

But I'd like to finish CI for BSD platform before I move.

@catapcatap marked this pull request as draftApril 2, 2024 20:22
@LeeTibbert
Copy link
Contributor

@catap

re:Let me ping @LeeTibbert as well.

I have been offline for awhile and am about to go offline for another longish (weeks) while.
I'll take a look if I can before I go offline again.

My rapid "wet" reading is that section probably long predates me and has to do with
what is and is_not POSIX and what is intended to be allowed in SN posixlib.

I believe, but would have to re-ground myself, that XOPEN is a superset of POSIX and
that the original intent was that only POSIX and possibly XSI were allowed in posixlib.

Compiling with _XOPEN_VERSION macro defined enabled the compilation of "intended-to-be-excluded"
XOPEN functions, so it was #undef'd. I think the #undef was because we do not have absolute control
over the compiler flags passed in; a user could -D_XOPEN_VERSION.

TL;DR - in case events need action before I can do all my evidence collection & tracing.

I think the ugly but cleanest solution is to put explicit OS specific guards around the _XOPEN_VERSION
handling. Again, ugly but gives future devos a sporting chance of understanding the logic chain.

That is, have the existing section for linux, MacOS (Windows?) and a new section
which does the alternate define of this PR for FreeBSD, NetBSD, and known others as they
may apply.

I would end with a "Unsupported OS" #error pragma.

Each OS gets what they are happy with and what has been tested & shown to work.

@catap
Copy link
ContributorAuthor

catap commentedApr 19, 2024 via email

On Fri, 19 Apr 2024 17:28:14 +0200, LeeTibbert wrote: I would end with a "Unsupported OS" #error pragma. Each OS gets what they are happy with and what has been tested & shown to work.
Feel free to push into this branch nessesary changes, and we may discuss it.Right now no rush with it, we have plenty of time to discus the right solution.
-- wbr, Kirill

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@WojciechMazurWojciechMazurWojciechMazur left review comments

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@catap@ekrich@LeeTibbert@WojciechMazur

[8]ページ先頭

©2009-2025 Movatter.jp