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

build: add _Generic selection test to autoconf #146

Merged
merged 2 commits into from
Mar 10, 2022

Conversation

underwoo
Copy link
Member

configure will fail with a note if the C compiler does not support the _Generic selection introduced in C11 - https://en.cppreference.com/w/c/language/generic

Fixes #102

configure will fail with a note if the C compiler does not support the _Generic selection introduced in C11 - https://en.cppreference.com/w/c/language/generic
@underwoo underwoo added this to the 2022.01 milestone Feb 23, 2022
@ngs333
Copy link
Contributor

ngs333 commented Feb 23, 2022

@underwoo
Was this tested?

Copy link
Contributor

@ngs333 ngs333 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will wait for the merge of upstream PR before testing and merging.

Copy link
Contributor

@ceblanton ceblanton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried this and it did not work as expected. As a control case, I commented out the module load gcc in the GFDL-WS site file, then did a regular compilation. ./configure worked and the compile failed with the telltale syntax errors:

create_xgrid.c(1311): error: expected an expression
          if(fabs(determ) < EPSLN30) {

Then I reran with these changes, starting with a fresh clean and autoreconf -i. ./configure now barks with:

./configure: line 4675: GX_C__GENERIC: command not found
./configure: line 4676: test: =: unary operator expected

but still passes and create the Makefiles.

@ngs333
Copy link
Contributor

ngs333 commented Mar 4, 2022

@ceblanton , @underwoo
I ran into the exact smame issue Chris shows above (#146 (review)). I was using analysis.

@ngs333 ngs333 assigned underwoo and unassigned ngs333 Mar 9, 2022
@underwoo
Copy link
Member Author

I just noticed I forgot to add the gx_c__generic.m4 file to the commit. I'll get that added, and push.

This is needed to test for the _Generic C11-style generic selection.
@underwoo
Copy link
Member Author

@ngs333 @ceblanton I pushed the GC_C__GENERIC m4 macro. Please try again.

@ngs333 ngs333 merged commit 7cc3119 into NOAA-GFDL:master Mar 10, 2022
@ngs333
Copy link
Contributor

ngs333 commented Mar 10, 2022

I verified the failure and appropriate message for the case when the compiler is not compliant.

@underwoo underwoo deleted the 102-c.generic branch October 16, 2022 15:49
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.

Add automake test for C99 standards compliance
3 participants