[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT PATCH] include/essentials: Introduce __maybe_unused attribute

On 07/27/2018 12:42 PM, Simon Kuenzer wrote:
Introduce __maybe_unused attribute macro that should be used for cases
where the usage of a symbol depends on a configuration.

Code example:

  #include <uk/config.h>

  int myfunc(int myparam __maybe_unused)
      return (myparam * 48); /* myparam is used */
      return 0; /* myparam is not used but shall stay to keep API */

Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
Signed-off-by: Dafna Hirschfeld <dafna3@xxxxxxxxx>

Reviewed-by: Florian Schmidt <florian.schmidt@xxxxxxxxx>

Thanks for the patch, pushing to staging now.
  include/uk/essentials.h | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/include/uk/essentials.h b/include/uk/essentials.h
index f9a7fd1..3c16e30 100644
--- a/include/uk/essentials.h
+++ b/include/uk/essentials.h
@@ -55,6 +55,9 @@ extern "C" {
  #ifndef __used
  #define __used                 __attribute__((used))
+#ifndef __maybe_unused
+#define __maybe_unused         __attribute__((unused))
  #ifndef __unused
  #define __unused               __attribute__((unused))

Dr. Florian Schmidt
Research Scientist,
Systems and Machine Learning Group
NEC Laboratories Europe
Kurfürsten-Anlage 36, D-69115 Heidelberg
Tel.     +49 (0)6221 4342-265
Fax:     +49 (0)6221 4342-155
e-mail:  florian.schmidt@xxxxxxxxx
Registered at Amtsgericht Mannheim, Germany, HRB728558

Minios-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.