Skip to content

add -Werror unit tests#15

Open
haampie wants to merge 2 commits into
mainfrom
hs/fix/tests-flags
Open

add -Werror unit tests#15
haampie wants to merge 2 commits into
mainfrom
hs/fix/tests-flags

Conversation

@haampie
Copy link
Copy Markdown
Member

@haampie haampie commented May 15, 2026

No description provided.

Copy link
Copy Markdown
Collaborator

@kwryankrattiger kwryankrattiger left a comment

Choose a reason for hiding this comment

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

A couple small issues

Comment thread test/run.sh

_werror_set_mode all
_out=$(dump_args cc "$_in2")
expect_contains werror_all2 "$_out" '-Werror'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
expect_contains werror_all2 "$_out" '-Werror'
expect_contains werror_all2 "$_out" '-Werror'
expect_not_contains werror_all2 "$_out" '-Werror-implicit-function-declaration'

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

In all mode it's kept

Copy link
Copy Markdown
Collaborator

@kwryankrattiger kwryankrattiger May 20, 2026

Choose a reason for hiding this comment

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

Ah, I missed the star for the all matching. In that case, we should ensure they are both still there.

Suggested change
expect_contains werror_all2 "$_out" '-Werror'
expect_contains werror_all2 "$_out" '-Werror'
expect_contains werror_all2 "$_out" '-Werror-implicit-function-declaration'

Comment thread test/run.sh
Comment thread test/run.sh
;;
specific)
SPACK_COMPILER_FLAGS_KEEP='-Werror-*|-Werror=*'
SPACK_COMPILER_FLAGS_REPLACE='-Werror-|-Wno-error= -Werror|-Wno-error'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
SPACK_COMPILER_FLAGS_REPLACE='-Werror-|-Wno-error= -Werror|-Wno-error'
SPACK_COMPILER_FLAGS_REPLACE='-Werror|-Wno-error'

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This isn't right, -Werror-x should be replaced with -Wno-error=x.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

In this context it looks like it conflicts with the SPACK_COMPILER_FLAGS_KEEP. You say keep specific errors, and also replace specific errors -Wno- prefix.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hm, maybe this is a good test for that reason. Maybe also worth documenting that behavior somewhere other than the code.

Signed-off-by: Harmen Stoppels <me@harmenstoppels.nl>
@haampie haampie force-pushed the hs/fix/tests-flags branch from 5db899a to 5b0d8bb Compare May 20, 2026 08:16
Signed-off-by: Harmen Stoppels <harmenstoppels@gmail.com>
@haampie haampie force-pushed the hs/fix/tests-flags branch from 5951989 to a91759e Compare May 20, 2026 08:34
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