Skip to content

Conversation

@keith-packard
Copy link
Contributor

PR #54638 proposes eliminating -ffreestanding when building with a C library other than the minimal C library. When building in this mode, clang finds a number of things to complain about in the code, including calls to abs with unsigned/float values and inappropriate types to printf.

This series also includes a C language conformance fix -- code using labels on declarations, which is not valid.

@zephyrbot
Copy link

The following west manifest projects have been modified in this Pull Request:

Name Old Revision New Revision Diff
hal_st zephyrproject-rtos/hal_st@cccbc24 (master) zephyrproject-rtos/hal_st#14 zephyrproject-rtos/hal_st#14/files

Note: This message is automatically posted and updated by the Manifest GitHub Action.

peter-mitsis
peter-mitsis previously approved these changes Mar 31, 2023
@keith-packard
Copy link
Contributor Author

This depends on pr #56489

@carlescufi
Copy link
Member

This depends on pr #56489

It's merged now

@keith-packard
Copy link
Contributor Author

It's merged now

Thanks!

@carlescufi
Copy link
Member

@keith-packard could you update this PR to remove the change to west.yml which already got in?

This case takes a float value and passes it to the integer abs function,
storing the result in an integer type variable. That looks like a possible
error to clang, so insert an explicit cast to int to make the compiler
happy.

Signed-off-by: Keith Packard <keithp@keithp.com>
C only permits labels on statements, not declarations.  Separate the
declarations from the assignments so that the labels can target
statements instead.

Signed-off-by: Keith Packard <keithp@keithp.com>
Clang complains when an unsigned value is passed to abs, even though there
is an implicit cast to a signed type. Insert an explicit cast to make clang
happy.

Signed-off-by: Keith Packard <keithp@keithp.com>
Clang detects a value of the wrong size passed to printf with %h or %hh
modifiers. Insert explicit casts to the expected type.

Signed-off-by: Keith Packard <keithp@keithp.com>
@keith-packard
Copy link
Contributor Author

@keith-packard could you update this PR to remove the change to west.yml which already got in?

done.

@keith-packard keith-packard removed DNM This PR should not be merged (Do Not Merge) manifest manifest-hal_st labels Apr 4, 2023
@carlescufi carlescufi merged commit 688e255 into zephyrproject-rtos:main Apr 5, 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 this pull request may close these issues.

7 participants