nasa / FM

The Core Flight System (cFS) File Manager (FM) application.
Apache License 2.0
42 stars 24 forks source link

Remove `static` designation from CFE_TBL_FileDef objects #66

Closed jphickey closed 1 year ago

jphickey commented 1 year ago

Checklist (Please check before submitting)

Is your feature request related to a problem? Please describe. Having a global declared as static is supposed to be for cases where the symbol is not to be referenced outside of that compilation unit (that is, it makes the symbol "hidden", so to speak). It prevents other compilation units being linked with this unit from seeing the symbol.

Somewhere along the way, this keyword got applied to table definitions in many CFS apps. This is not required and even a bad idea for several reasons:

  1. Technically, the elf2cfetbl tool does need to find the symbol. (Thus if it is truly "hidden" it will not work - this seems to rely on the name still appearing in the ELF but simply as a different type of symbol)
  2. Tables are not linked with other compilation units (and thus no reason/justification on why the symbol name would ever need to be hidden)
  3. The compiler warns about it (because it is a global that does not appear to be used anywhere, at least in the compiler's view)
  4. In order to get around the previous issue and fix the warning, an __attribute__((__used__)) was added. Attributes like this are a non-standardized extension, and these are not supposed to be used in FSW code.

Describe the solution you'd like Just make it a regular (non-static) symbol with no special attributes - everything "just works" this way.

Additional context See https://github.com/nasa/FM/blob/c4063cc9db54c505d1029c2e1460142f97da26f5/fsw/tables/fm_monitor.c#L41-L42

Requester Info Joseph Hickey, Vantage Systems, Inc.