Skip to content

Bind C warnings#49

Merged
markleader merged 7 commits intonasa:mainfrom
btmy87:bindc_warnings
Mar 2, 2026
Merged

Bind C warnings#49
markleader merged 7 commits intonasa:mainfrom
btmy87:bindc_warnings

Conversation

@btmy87
Copy link
Copy Markdown
Contributor

@btmy87 btmy87 commented Feb 28, 2026

Summary

Bind C examples generate multiple warnings of the form below. Switching cea.h from const cea_array to const const cea real[] avoids these warnings, and permits passing the expected types.
cea\source\bind\c\samples\rp1311_example9.c(75,68): warning: passing 'const cea_real[1]' (aka 'const double[1]') to parameter of type 'cea_array' (aka 'double *') discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] 75 | cea_rocket_solver_solve_fac(solver, soln, weights, pc, pip, 3, subar, 0, supar, 3, 0, hc, TRUE, ac_at, FALSE, 0.0, FALSE);

Changes

  • Switched const cea_array to const cea_real[] to suppress warnings. Also better matches the intent. The array data is treated as const, not just the pointer.
  • Updated example 9 to demonstrate that both const and non-const cea_real[] can be passed without warnings.

Testing

  • All CI tests passing.
  • Verified error suppression on Windows with latest msvc, icx, clang-cl, and gcc
  • Verified error suppression on Debian with latest gcc.
  • Updated bind c test configuration for gcc-13 to Ubuntu 24.04 from Ubuntu 22.04. The later github runner image has trouble with gcc-13.

Compatibility / Numerical behavior

  • No expected changes to numerical results
  • Expected changes (explain and provide validation)

btmy87 and others added 7 commits February 21, 2026 19:35
Using const cea_real[] instead of const cea_array makes it easier
to pass data to the inface without generating incompatible pointer
type warnings.  It also better reflects the design intent; not only
will the pointer not be changed, but the data pointed to will not
be changed.  Updated example 9 to demonstrate that this works without
warnings for both const and non-const data.
@markleader markleader merged commit f9f9952 into nasa:main Mar 2, 2026
22 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants