Skip to content

Commit

Permalink
Avoid re-define of O_BINARY on Windows
Browse files Browse the repository at this point in the history
(Fixes #788)
  • Loading branch information
Nightwalker-87 committed Apr 7, 2020
1 parent 59c5cfd commit bf840a1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@
#include "stlink/mmap.h"
#include "stlink/logging.h"

#ifndef _WIN32
#define O_BINARY 0 //! @todo get rid of this OH MY (@xor-gate)
#if defined _WIN32 || defined _WIN64 // for Windows i386 or x86-64

This comment has been minimized.

Copy link
@slyshykO

slyshykO Apr 7, 2020

Collaborator

there is no need to check _WIN32 and _WIN64
_WIN32 defined for both i386 and x64

This comment has been minimized.

Copy link
@Nightwalker-87

Nightwalker-87 Apr 7, 2020

Author Member

I know that _WIN32 is defined for both, but what if a build system is used that solely relates to _WIN64 ?

This comment has been minimized.

Copy link
@slyshykO

slyshykO Apr 7, 2020

Collaborator

This macro defined in toolchains, not in a build system.

This comment has been minimized.

Copy link
@Nightwalker-87

Nightwalker-87 Apr 7, 2020

Author Member

I see, but what does that change regarding argumentation? Why should a fallback to _WIN32 occur if not necessary?

This comment has been minimized.

Copy link
@slyshykO

slyshykO Apr 7, 2020

Collaborator

Cause

#if defined _WIN32

is less code than

#if defined _WIN32 || defined _WIN64

This comment has been minimized.

Copy link
@slyshykO

slyshykO Apr 7, 2020

Collaborator

And this code

#if defined _WIN32

do the same as you code.

This comment has been minimized.

Copy link
@Nightwalker-87

Nightwalker-87 Apr 7, 2020

Author Member

... but still solely offers the possibility to compile for 32-bit.

This comment has been minimized.

Copy link
@slyshykO

slyshykO Apr 8, 2020

Collaborator

... but still solely offers the possibility to compile for 32-bit.

No, as I said previously, _WIN32 defined always for win build.

This comment has been minimized.

Copy link
@Nightwalker-87

Nightwalker-87 Apr 8, 2020

Author Member

Changed in commit 9f2cad2.

#ifndef O_BINARY
#define O_BINARY 0
#endif
#endif

#ifdef _MSC_VER
#define __attribute__(x)
#endif
Expand Down

0 comments on commit bf840a1

Please sign in to comment.