Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove static designation from CFE_TBL_FileDef objects #66

Closed
3 tasks done
jphickey opened this issue Dec 2, 2022 · 0 comments · Fixed by #82
Closed
3 tasks done

Remove static designation from CFE_TBL_FileDef objects #66

jphickey opened this issue Dec 2, 2022 · 0 comments · Fixed by #82

Comments

@jphickey
Copy link
Contributor

jphickey commented Dec 2, 2022

Checklist (Please check before submitting)

  • I reviewed the Contributing Guide.
  • I reviewed the README file to see if the feature is in the major future work.
  • I performed a cursory search to see if the feature request is relevant, not redundant, nor in conflict with other tickets.

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

static CFE_TBL_FileDef_t CFE_TBL_FileDef
__attribute__((__used__)) = {"FM_MonitorTable", FM_APP_NAME "." FM_TABLE_CFE_NAME, FM_TABLE_DEF_DESC,

Requester Info
Joseph Hickey, Vantage Systems, Inc.

jphickey added a commit to jphickey/FM that referenced this issue Feb 9, 2023
This is not needed, and it ends up also needing a compiler-specific
attribute to avoid a warning.  Much simpler without it.
dzbaker added a commit that referenced this issue Feb 9, 2023
Fix #66, remove static from table definition
@dzbaker dzbaker added this to the Equuleus milestone Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants