Skip to content

Commit

Permalink
Introduced C99's Boolean (_Bool).
Browse files Browse the repository at this point in the history
  • Loading branch information
hfp committed Apr 6, 2020
1 parent e1531e0 commit 32b687d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions include/libxsmm_macros.h
Expand Up @@ -779,6 +779,9 @@ LIBXSMM_API_INLINE int libxsmm_nonconst_int(int i) { return i; }
# pragma offload_attribute(pop)
#endif

#if !defined(_Bool)
# define _Bool int
#endif
#if defined(_WIN32) && 0
# define LIBXSMM_SNPRINTF(S, N, ...) _snprintf_s(S, N, _TRUNCATE, __VA_ARGS__)
#elif defined(__STDC_VERSION__) && (199901L <= __STDC_VERSION__ || defined(__GNUC__))
Expand Down
2 changes: 1 addition & 1 deletion version.txt
@@ -1 +1 @@
master-1.15-93
master-1.15-94

6 comments on commit 32b687d

@jedbrown
Copy link

Choose a reason for hiding this comment

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

Is this really essential? It is a violation of C99 (unless all callers ensure that no system header is included after libxsmm), which says (§7.1.2.4):

The program shall not have any macros with names lexically identical to keywords currently defined prior to the inclusion.

Note that the size and behavior of _Bool as defined here is different from C99.

@hfp
Copy link
Collaborator Author

@hfp hfp commented on 32b687d Jun 24, 2020

Choose a reason for hiding this comment

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

Only solution is to not use _Bool anywhere in our ABI. I will just check and perhaps remove it entirely.

@hfp
Copy link
Collaborator Author

@hfp hfp commented on 32b687d Jun 24, 2020

Choose a reason for hiding this comment

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

Is this issue hitting you with some real case? If so, I may need to issue an updated release.

@hfp
Copy link
Collaborator Author

@hfp hfp commented on 32b687d Jun 24, 2020

Choose a reason for hiding this comment

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

Ok, found it (libCEED). I have fixed this on our side as well (143409c). Let me know if you need a new release.

@jedbrown
Copy link

Choose a reason for hiding this comment

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

Thank you. We can just pin our CI to the commit; no need to make a special release.

Note that it's more typical to #include <stdbool.h>, which defines bool, true, and false. This definition should be compatible with that in C++2003, and stdbool.h makes it work (as a GNU extension) in older C++ dialects. Or just use int as you've done.

@hfp
Copy link
Collaborator Author

@hfp hfp commented on 32b687d Jun 26, 2020

Choose a reason for hiding this comment

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

Version 1.16.1 (due today) will fix this issue.

Please sign in to comment.