Re: [PATCH] fixed warning related to spstdc17

2023-10-30 Thread Sebastian Huber

On 29.10.23 02:44, zack leung wrote:
./../../cpukit/include/rtems/score/schedulerpriority.h:87:21: error: 
field 'Base' has incomplete type

    87 |   Scheduler_Context Base;
       |                     ^~~~
../../../cpukit/include/rtems/score/schedulersimple.h:89:21: error: 
field 'Base' has incomplete type

    89 |   Scheduler_Context Base;
       |                     ^~~~

I get this error when using typedefs


Yes, the

typedef struct Scheduler_Context Scheduler_Context;

only creates the typedef and the structure name. This is why I also wrote:

Then you have to make sure that #if !defined(RTEMS_SMP) no objects of 
this type are used.


For example:

diff --git a/cpukit/include/rtems/score/schedulersimple.h 
b/cpukit/include/rtems/score/schedulersimple.h

index d9acd3dea0..0db72b2a51 100644
--- a/cpukit/include/rtems/score/schedulersimple.h
+++ b/cpukit/include/rtems/score/schedulersimple.h
@@ -83,10 +83,12 @@ extern "C" {
  * @brief Simple scheduler context.
  */
 typedef struct {
+#if !defined(RTEMS_SMP)
   /**
* @brief Basic scheduler context.
*/
   Scheduler_Context Base;
+#endif

   /**
* @brief One ready queue for all ready threads.

--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH] fixed warning related to spstdc17

2023-10-30 Thread zack leung
./../../cpukit/include/rtems/score/schedulerpriority.h:87:21: error: field
'Base' has incomplete type
   87 |   Scheduler_Context Base;
  | ^~~~
../../../cpukit/include/rtems/score/schedulersimple.h:89:21: error: field
'Base' has incomplete type
   89 |   Scheduler_Context Base;
  | ^~~~

I get this error when using typedefs



#if defined(RTEMS_SMP)
typedef struct Scheduler_Context {



/**
 * @brief Lock to protect this scheduler instance.
 */
ISR_lock_Control Lock;

/**
 * @brief The set of processors owned by this scheduler instance.
 */
Processor_mask Processors;

} Scheduler_Context;
#endif
#if !defined(RTEMS_SMP)
 typedef struct Scheduler_Context Scheduler_Context;
#endif
/**

or

#if defined(RTEMS_SMP)
typedef struct Scheduler_Context {



/**
 * @brief Lock to protect this scheduler instance.
 */
ISR_lock_Control Lock;

/**
 * @brief The set of processors owned by this scheduler instance.
 */
Processor_mask Processors;

} Scheduler_Context;
#else
 typedef struct Scheduler_Context Scheduler_Context;
#endif
/**

On Fri, 27 Oct 2023 at 01:40, Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

>
>
> On 27.10.23 03:43, zack leung wrote:
> > ping
> >
> > On Tue, 24 Oct 2023 at 22:17, zack leung  > > wrote:
> >
> > that didn't work but i'm thinking of defining a char array that is
> > equal to the size of the processor lock and the isr lock?
>
> This is a bit complicated and still leads to a size increase.
>
> > i figured
> > that the processor lock is 64 bits and isr lock is a one bit?
> > I'm confused on how to make an api define do you have a file i can
> > look at?
>
> Maybe you try to fix the Scheduler_Context warning first. It is easier
> to fix. I am pretty sure that this approach works:
>
> Get rid of the empty structures is to just provide typedefs, for example:
>
> #if defined(RTEMS_SMP)
> typedef struct Scheduler_Context {
> ...
> } Scheduler_Context;
> #else
> typedef struct Scheduler_Context Scheduler_Context;
> #endif
>
> Then you have to make sure that #if !defined(RTEMS_SMP) no objects of
> this type are used.
>
> --
> embedded brains GmbH
> Herr Sebastian HUBER
> Dornierstr. 4
> 82178 Puchheim
> Germany
> email: sebastian.hu...@embedded-brains.de
> phone: +49-89-18 94 741 - 16
> fax:   +49-89-18 94 741 - 08
>
> Registergericht: Amtsgericht München
> Registernummer: HRB 157899
> Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
> Unsere Datenschutzerklärung finden Sie hier:
> https://embedded-brains.de/datenschutzerklaerung/
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel