All of lore.kernel.org
 help / color / mirror / Atom feed
* <evl/heap.h> compile conflict with Boost
@ 2022-06-13 14:39 Russell Johnson
  2022-06-13 15:17 ` Julien Blanc
  0 siblings, 1 reply; 16+ messages in thread
From: Russell Johnson @ 2022-06-13 14:39 UTC (permalink / raw)
  To: xenomai

I have a class that includes both <evl/heap.h> and some boost headers.
Whenever I go to compile it, I get an error that looks like it has to do
with the definition of "fallthrough" in <evl/compile.h> conflicting with the
definition of "fallthrough" in Boost. It compiles fine if there is no Boost
header in the class. I use boost throughout my entire app, so I need to
figure how to get both of these libraries to play nice with each other. Any
ideas? ( I am using gcc 8.3 and boost 1.70.0)

 



 

If you cannot see the image above, here is the error from the console:

 

/home/rtlogic/projects/t4-sfhm-test/vendors/boost-1.70.0/software/include/bo
ost/format/parsing.hpp: In function 'bool
boost::io::detail::parse_printf_directive(Iter&, const Iter&,
boost::io::detail::format_item<Ch, Tr, Alloc>*, const Facet&, std::size_t,
unsigned char)':

/opt/evl/include/evl/compiler.h:64:36: error: '__fallthrough__' was not
declared in this scope

#define fallthrough __attribute__((__fallthrough__))

                                    ^~~~~~~~~~~~~~~

/home/rtlogic/projects/t4-sfhm-test/vendors/boost-1.70.0/software/include/bo
ost/config/compiler/gcc.hpp:309:44: note: in expansion of macro
'fallthrough'

#  define BOOST_FALLTHROUGH __attribute__((fallthrough))

                                            ^~~~~~~~~~~

/home/rtlogic/projects/t4-sfhm-test/vendors/boost-1.70.0/software/include/bo
ost/format/parsing.hpp:325:17: note: in expansion of macro
'BOOST_FALLTHROUGH'

                 BOOST_FALLTHROUGH;

                ^~~~~~~~~~~~~~~~~

/opt/evl/include/evl/compiler.h:64:36: note: suggested alternative:
'fallthrough'

#define fallthrough __attribute__((__fallthrough__))

 

____________

Russell Johnson

Software Development Engineer, Kratos Space

Kratos Defense & Security Solutions, Inc.

12515 Academy Ridge View
Colorado Springs, Colorado 80921
Main:  719.472.3323x1192

Direct: 719.884.6392

 <mailto:russell.johnson@kratosdefense.com>
russell.johnson@kratosdefense.com
 <http://www.kratosdefense.com/> www.kratosdefense.com



 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 115340 bytes
Desc: not available
URL: <http://xenomai.org/pipermail/xenomai/attachments/20220613/f9ee151d/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.jpg
Type: image/jpeg
Size: 2582 bytes
Desc: not available
URL: <http://xenomai.org/pipermail/xenomai/attachments/20220613/f9ee151d/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6759 bytes
Desc: not available
URL: <http://xenomai.org/pipermail/xenomai/attachments/20220613/f9ee151d/attachment.bin>

^ permalink raw reply	[flat|nested] 16+ messages in thread
* Re: <evl/heap.h> compile conflict with Boost
@ 2022-06-14 14:18 Russell Johnson
  2022-06-14 15:11 ` Jan Kiszka
  0 siblings, 1 reply; 16+ messages in thread
From: Russell Johnson @ 2022-06-14 14:18 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: Xenomai

From 452e8b2ca8ecd53571a6b1f5d8b9ab23cd67f99d Mon Sep 17 00:00:00 2001
From: Russell Johnson <russell.johnson@kratosdefense.com>
Date: Tue, 14 Jun 2022 08:10:14 -0600
Subject: [PATCH] fixing conflict with C++ [[fallthough]], and maybe at some
 point in the future with the C2X standard

---
 benchmarks/hectic.c    | 10 +++++-----
 benchmarks/latmus.c    |  4 ++--
 include/evl/compiler.h |  2 +-
 lib/thread.c           |  2 +-
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/benchmarks/hectic.c b/benchmarks/hectic.c
index 6b6b3b5..886f7d2 100644
--- a/benchmarks/hectic.c
+++ b/benchmarks/hectic.c
@@ -336,7 +336,7 @@ static void *sleeper_switcher(void *cookie)
                        break;
                case 1:
                        handle_bad_fpreg(param->cpu, ~0, -1);
-                       fallthrough;
+                       __fallthrough;
                case -1:
                        clean_exit(EXIT_FAILURE);
                }
@@ -469,7 +469,7 @@ static void *rtup(void *cookie)
                        break;
                case 1:
                        handle_bad_fpreg(param->cpu, ~0, -1);
-                       fallthrough;
+                       __fallthrough;
                case -1:
                        clean_exit(EXIT_FAILURE);
                }
@@ -549,7 +549,7 @@ static void *rtus(void *cookie)
                        break;
                case 1:
                        handle_bad_fpreg(param->cpu, ~0, -1);
-                       fallthrough;
+                       __fallthrough;
                case -1:
                        clean_exit(EXIT_FAILURE);
                }
@@ -646,7 +646,7 @@ static void *rtuo(void *cookie)
                        break;
                case 1:
                        handle_bad_fpreg(param->cpu, ~0, -1);
-                       fallthrough;
+                       __fallthrough;
                case -1:
                        clean_exit(EXIT_FAILURE);
                }
@@ -811,7 +811,7 @@ static int task_create(struct cpu_tasks *cpu,
        case RTUS:
        case RTUO:
                param->swt.flags = HECTIC_OOB_WAIT;
-               fallthrough;
+               __fallthrough;
        case SLEEPER:
        case SWITCHER:
                err = ioctl(cpu->fd, EVL_HECIOC_REGISTER_UTASK,
&param->swt);
diff --git a/benchmarks/latmus.c b/benchmarks/latmus.c
index a507e80..59ed448 100644
--- a/benchmarks/latmus.c
+++ b/benchmarks/latmus.c
@@ -1252,10 +1252,10 @@ int main(int argc, char *const argv[])
                        switch (*endptr) {
                        case 'd':
                                timeout *= 24;
-                               fallthrough;
+                               __fallthrough;
                        case 'h':
                                timeout *= 60;
-                               fallthrough;
+                               __fallthrough;
                        case 'm':
                                timeout *= 60;
                                break;
diff --git a/include/evl/compiler.h b/include/evl/compiler.h
index fce2766..8e6ad8c 100644
--- a/include/evl/compiler.h
+++ b/include/evl/compiler.h
@@ -61,7 +61,7 @@
 #endif

 #ifndef __fallthrough
-#define fallthrough    __attribute__((__fallthrough__))
+#define __fallthrough  __attribute__((__fallthrough__))
 #endif

 #ifndef __alloc_size
diff --git a/lib/thread.c b/lib/thread.c
index 4b836cc..dc2ca6c 100644
--- a/lib/thread.c
+++ b/lib/thread.c
@@ -111,7 +111,7 @@ int evl_attach_thread(int flags, const char *fmt, ...)
                break;
        default:
                policy = SCHED_FIFO;
-               fallthrough;
+               __fallthrough;
        case SCHED_FIFO:
        case SCHED_RR:
                priority = param.sched_priority;
--
1.8.3.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6759 bytes
Desc: not available
URL: <http://xenomai.org/pipermail/xenomai/attachments/20220614/376ef8cc/attachment.bin>

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2022-06-14 16:06 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-13 14:39 <evl/heap.h> compile conflict with Boost Russell Johnson
2022-06-13 15:17 ` Julien Blanc
2022-06-13 21:25   ` [External] - " Russell Johnson
2022-06-14  6:54   ` Philippe Gerum
2022-06-14  7:08     ` Julien Blanc
2022-06-14  8:04       ` Philippe Gerum
2022-06-14  8:29         ` Julien Blanc
2022-06-14  8:41           ` Bezdeka, Florian
2022-06-14  9:01           ` Philippe Gerum
2022-06-14  9:44             ` Bezdeka, Florian
2022-06-14 10:34               ` Julien Blanc
2022-06-14 10:43                 ` Philippe Gerum
2022-06-14 13:27                   ` [External] - " Russell Johnson
2022-06-14 14:05                     ` Philippe Gerum
2022-06-14 14:18 Russell Johnson
2022-06-14 15:11 ` Jan Kiszka
2022-06-14 15:22   ` Philippe Gerum
2022-06-14 15:34     ` [External] - " Russell Johnson
2022-06-14 16:06       ` Philippe Gerum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.