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

Add -imacros to C flags #3430

Merged
merged 2 commits into from
Jan 20, 2021

Conversation

mbrunnen
Copy link

@mbrunnen mbrunnen commented Nov 3, 2020

I am working in a project, that has some -imacros, using the Zephyr RTOS.
One problem was, that the compiler from the special toolchain was ignored, even though it is mentioned in the compile_commands.json file. I did fix it locally, with b:ale_c_cc_executable.The other problem is that the -imacros flag is ignored, hence this pull request.

Here is an extract from the compile_commands.json:

{
  "directory": "/home/mbrunnen/projects/embedded-system/applications/arbitrary-firmware/build",
  "command": "/home/mbrunnen/.local/opt/zephyr-sdk-0.11.4/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc \
    -DBUILD_VERSION=zephyr-v2.4.0-1136-gcf1bd1780417 \
    -DHSE_VALUE=8000000 \
    -DKERNEL \
    -DLV_CONF_INCLUDE_SIMPLE=1 \
    -DSTM32F103xB \
    -DUSE_FULL_LL_DRIVER \
    -DUSE_HAL_DRIVER \
    -D_FORTIFY_SOURCE=2 \
    -D__PROGRAM_START \
    -D__ZEPHYR__=1 \
    -I/home/mbrunnen/projects/embedded-system/system/zephyr/include \
    -Izephyr/include/generated \
    -I/home/mbrunnen/projects/embedded-system/system/zephyr/soc/arm/st_stm32/stm32f1 \
    -I/home/mbrunnen/projects/embedded-system/system/zephyr/drivers \
    -I/home/mbrunnen/projects/embedded-system/system/zephyr/soc/arm/st_stm32/common/. \
    -I/home/mbrunnen/projects/embedded-system/system/zephyr/soc/arm/st_stm32/common \
    -I/home/mbrunnen/projects/embedded-system/modules/hal/cmsis/CMSIS/Core/Include \
    -I/home/mbrunnen/projects/embedded-system/modules/hal/stm32/stm32cube/stm32f1xx/soc \
    -I/home/mbrunnen/projects/embedded-system/modules/hal/stm32/stm32cube/stm32f1xx/drivers/include \
    -I/home/mbrunnen/projects/embedded-system/modules/hal/stm32/stm32cube/stm32f1xx/drivers/include/Legacy \
    -I/home/mbrunnen/projects/embedded-system/system/zephyr/lib/gui/lvgl \
    -I/home/mbrunnen/projects/embedded-system/modules/lib/gui/lvgl \
    -isystem /home/mbrunnen/projects/embedded-system/system/zephyr/lib/libc/minimal/include \
    -isystem /home/mbrunnen/.local/opt/zephyr-sdk-0.11.4/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/9.2.0/include \
    -isystem /home/mbrunnen/.local/opt/zephyr-sdk-0.11.4/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/9.2.0/include-fixed    \
    -Os \
    -imacros /home/mbrunnen/projects/embedded-system/applications/arbitrary-firmware/build/zephyr/include/generated/autoconf.h \
    -ffreestanding \
    -fno-common \
    -g \
    -mcpu=cortex-m3 \
    -mthumb \
    -mabi=aapcs \
    -imacros /home/mbrunnen/projects/embedded-system/system/zephyr/include/toolchain/zephyr_stdint.h \
    -Wall \
    -Wformat \
    -Wformat-security \
    -Wno-format-zero-length \
    -Wno-main \
    -Wno-pointer-sign \
    -Wpointer-arith \
    -Wno-address-of-packed-member \
    -Wno-unused-but-set-variable \
    -Werror=implicit-int \
    -fno-asynchronous-unwind-tables \
    -fno-pie \
    -fno-pic \
    -fno-strict-overflow \
    -fno-reorder-functions \
    -fno-defer-pop \
    -fmacro-prefix-map=/home/mbrunnen/projects/embedded-system/applications/arbitrary-firmware=CMAKE_SOURCE_DIR \
    -fmacro-prefix-map=/home/mbrunnen/projects/embedded-system/system/zephyr=ZEPHYR_BASE \
    -fmacro-prefix-map=/home/mbrunnen/projects/embedded-system=WEST_TOPDIR \
    -ffunction-sections \
    -fdata-sections \
    -std=c99 \
    -nostdinc \
    -o CMakeFiles/app.dir/src/main.c.obj   \
    -c /home/mbrunnen/projects/embedded-system/applications/arbitrary-firmware/src/main.c",
  "file": "/home/mbrunnen/projects/embedded-system/applications/arbitrary-firmware/src/main.c"
}

Copy link
Member

@w0rp w0rp left a comment

Choose a reason for hiding this comment

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

There's a test missing for this. If you search the codebase for the other switches here, there's one test that checks that the whitelisting of flags like these works. You should add some more text into that test and check that we permit the use of this flag too.

@w0rp w0rp self-assigned this Nov 21, 2020
@stale
Copy link

stale bot commented Dec 19, 2020

This pull request has been automatically marked as stale because it has not been updated recently. Make sure to write tests and document your changes. See :help ale-dev for information on writing tests.
If your pull request is good to merge, bother w0rp or another maintainer again, and get them to merge it.

@stale stale bot added the stale PRs/Issues no longer valid label Dec 19, 2020
@stale stale bot removed the stale PRs/Issues no longer valid label Dec 21, 2020
@mbrunnen
Copy link
Author

There's a test missing for this. If you search the codebase for the other switches here, there's one test that checks that the whitelisting of flags like these works. You should add some more text into that test and check that we permit the use of this flag too.

Ok, I have added the tests.

@stale
Copy link

stale bot commented Jan 18, 2021

This pull request has been automatically marked as stale because it has not been updated recently. Make sure to write tests and document your changes. See :help ale-dev for information on writing tests.
If your pull request is good to merge, bother w0rp or another maintainer again, and get them to merge it.

@stale stale bot added the stale PRs/Issues no longer valid label Jan 18, 2021
@hsanson hsanson removed the stale PRs/Issues no longer valid label Jan 20, 2021
@hsanson hsanson merged commit 8de0e7b into dense-analysis:master Jan 20, 2021
@mbrunnen mbrunnen deleted the mbn/fix-macros-include-c-flag branch March 3, 2021 21:38
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.

None yet

3 participants