Code Monkey home page Code Monkey logo

Comments (11)

pokgak avatar pokgak commented on June 21, 2024 1

I copied the clang commands use to compile xtimer.c and got the result below. The error is due to some redefined macros. By taking those macros out from the clang command, the file compiles successfully.

pokgak@mobi39:~/git/RIOT-mutate-samr21$ clang -c -DRIOT_FILE_RELATIVE="sys/xtimer/xtimer.c" -DRIOT_FILE_NOPATH="xtimer.c" -DDEVELHELP -Werror -DCPU_SAMR21 -DCPU_FAM_SAMD21 -D__SAMR21G18A__ -DDONT_USE_CMSIS_INIT -DDONT_USE_PREDEFINED_CORE_HANDLERS -DDONT_USE_PREDEFINED_PERIPHERALS_HANDLERS -mcpu=cortex-m0plus -mlittle-endian -mthumb -mfloat-abi=soft -ffunction-sections -fdata-sections -fno-builtin -fshort-enums -ggdb -g3 -Os -DCPU_MODEL_SAMR21G18A -DCPU_CORE_CORTEX_M0PLUS -target arm-none-eabi -Wno-atomic-alignment -Wno-unknown-warning-option -DRIOT_APPLICATION="tests_xtimer_now_irq" -DBOARD_SAMR21_XPRO="samr21-xpro" -DRIOT_BOARD=BOARD_SAMR21_XPRO -DCPU_SAMD21="samd21" -DRIOT_CPU=CPU_SAMD21 -DMCU_SAMD21="samd21" -DRIOT_MCU=MCU_SAMD21 -std=c99 -fno-common -Wall -Wextra -Wmissing-include-dirs -fdiagnostics-color -Wstrict-prototypes -Wold-style-definition -gz -Wformat=2 -include /home/pokgak/git/RIOT-mutate-samr21/tests/xtimer_now_irq/bin/samr21-xpro/riotbuild/riotbuild.h -isystem /opt/gcc-arm-none-eabi-9-2019-q4-major/arm-none-eabi/include/newlib-nano -isystem /opt/gcc-arm-none-eabi-9-2019-q4-major/arm-none-eabi/include -nostdinc -I/home/pokgak/git/RIOT-mutate-samr21/core/include -I/home/pokgak/git/RIOT-mutate-samr21/drivers/include -I/home/pokgak/git/RIOT-mutate-samr21/sys/include -I/home/pokgak/git/RIOT-mutate-samr21/boards/samr21-xpro/include -I/home/pokgak/git/RIOT-mutate-samr21/cpu/samd21/include -I/home/pokgak/git/RIOT-mutate-samr21/cpu/sam0_common/include -I/home/pokgak/git/RIOT-mutate-samr21/cpu/cortexm_common/include -I/home/pokgak/git/RIOT-mutate-samr21/cpu/cortexm_common/include/vendor -isystem /opt/gcc-arm-none-eabi-9-2019-q4-major/lib/gcc/arm-none-eabi/9.2.1/include -isystem /opt/gcc-arm-none-eabi-9-2019-q4-major/lib/gcc/arm-none-eabi/9.2.1/include-fixed -isystem /opt/gcc-arm-none-eabi-9-2019-q4-major/arm-none-eabi/include -I/home/pokgak/git/RIOT-mutate-samr21/sys/libc/include -o /home/pokgak/git/RIOT-mutate-samr21/tests/xtimer_now_irq/bin/samr21-xpro/xtimer/xtimer.o sys/xtimer/xtimer.c
In file included from <built-in>:1:
/home/pokgak/git/RIOT-mutate-samr21/tests/xtimer_now_irq/bin/samr21-xpro/riotbuild/riotbuild.h:11:9: error: 'RIOT_APPLICATION' macro redefined [-Werror,-Wmacro-redefined]
#define RIOT_APPLICATION "tests_xtimer_now_irq"
        ^
<command line>:12:9: note: previous definition is here
#define RIOT_APPLICATION tests_xtimer_now_irq
        ^
In file included from <built-in>:1:
/home/pokgak/git/RIOT-mutate-samr21/tests/xtimer_now_irq/bin/samr21-xpro/riotbuild/riotbuild.h:12:9: error: 'BOARD_SAMR21_XPRO' macro redefined [-Werror,-Wmacro-redefined]
#define BOARD_SAMR21_XPRO "samr21-xpro"
        ^
<command line>:13:9: note: previous definition is here
#define BOARD_SAMR21_XPRO samr21-xpro
        ^
In file included from <built-in>:1:
/home/pokgak/git/RIOT-mutate-samr21/tests/xtimer_now_irq/bin/samr21-xpro/riotbuild/riotbuild.h:14:9: error: 'CPU_SAMD21' macro redefined [-Werror,-Wmacro-redefined]
#define CPU_SAMD21 "samd21"
        ^
<command line>:15:9: note: previous definition is here
#define CPU_SAMD21 samd21
        ^
In file included from <built-in>:1:
/home/pokgak/git/RIOT-mutate-samr21/tests/xtimer_now_irq/bin/samr21-xpro/riotbuild/riotbuild.h:16:9: error: 'MCU_SAMD21' macro redefined [-Werror,-Wmacro-redefined]
#define MCU_SAMD21 "samd21"
        ^
<command line>:17:9: note: previous definition is here
#define MCU_SAMD21 samd21
        ^
4 errors generated.

from dextool.

joakim-brannstrom avatar joakim-brannstrom commented on June 21, 2024 1

working on the issue. I am able to replicate with openssl :)
I should have noticed it before because I now see that I had the problem "all along" just never reacted.

from dextool.

joakim-brannstrom avatar joakim-brannstrom commented on June 21, 2024

They should have been printed, all diagnostic errors. Like this:

info: Using x/database.sqlite3
info: Reading compilation database:

info: Analyze and mutation of files will only be done on those inside this directory root
info:   User input: /x
info:   Real path: /x
info: Restricting mutation to files in the following directory tree(s)
info: Analyzing /home/x/abs.cpp
error: /x/abs.cpp:4:18: error: expected ';' at end of declaration
error: Compile error in /x/abs.cpp. Skipping
...

from dextool.

pokgak avatar pokgak commented on June 21, 2024

Unfortunately not the case for me (see log). I excluded some directories that I'm not interested in the config files. If I re-include those directories, they too will print out those generic compile errors. I compiled dextool from source and currently on version dextool version v2.2.0-90-ge02897bd. This is also the same in v2.2.0 tag.

IDK if this is related but the project I'm using this on is normally compiled using arm-gcc.

info: Using /home/pokgak/git/RIOT-mutate-samr21/mutate/dextool_mutate.sqlite3
info: Reading compilation database:
/home/pokgak/git/RIOT-mutate-samr21/compile_commands.json
info: Analyze and mutation of files will only be done on those inside this directory root
info:   User input: .
info:   Real path: /home/pokgak/git/RIOT-mutate-samr21
info: Restricting mutation to files in the following directory tree(s)
info:   User input: sys/xtimer
info:   Real path: /home/pokgak/git/RIOT-mutate-samr21/sys/xtimer
info: Excluding files inside the following directory tree(s) from analysis
info:   User input: cpu/
info:   Real path: /home/pokgak/git/RIOT-mutate-samr21/cpu
info:   User input: boards
info:   Real path: /home/pokgak/git/RIOT-mutate-samr21/boards
info:   User input: core/
info:   Real path: /home/pokgak/git/RIOT-mutate-samr21/core
info:   User input: drivers/
info:   Real path: /home/pokgak/git/RIOT-mutate-samr21/drivers
info:   User input: tests/
info:   Real path: /home/pokgak/git/RIOT-mutate-samr21/tests
info:   User input: sys/pm_layered
info:   Real path: /home/pokgak/git/RIOT-mutate-samr21/sys/pm_layered
info:   User input: sys/tsrb
info:   Real path: /home/pokgak/git/RIOT-mutate-samr21/sys/tsrb
info:   User input: sys/fmt
info:   Real path: /home/pokgak/git/RIOT-mutate-samr21/sys/fmt
info:   User input: sys/auto_init
info:   Real path: /home/pokgak/git/RIOT-mutate-samr21/sys/auto_init
info:   User input: sys/test_utils
info:   Real path: /home/pokgak/git/RIOT-mutate-samr21/sys/test_utils
info:   User input: sys/isrpipe
info:   Real path: /home/pokgak/git/RIOT-mutate-samr21/sys/isrpipe
info:   User input: sys/stdio_uart
info:   Real path: /home/pokgak/git/RIOT-mutate-samr21/sys/stdio_uart
info:   User input: sys/shell
info:   Real path: /home/pokgak/git/RIOT-mutate-samr21/sys/shell
info:   User input: sys/newlib_syscalls_default
info:   Real path: /home/pokgak/git/RIOT-mutate-samr21/sys/newlib_syscalls_default
info:   User input: sys/div
info:   Real path: /home/pokgak/git/RIOT-mutate-samr21/sys/div
info: Analyzing /home/pokgak/git/RIOT-mutate-samr21/sys/xtimer/xtimer.c
error: Compile error in /home/pokgak/git/RIOT-mutate-samr21/sys/xtimer/xtimer.c. Skipping
info: Analyzing /home/pokgak/git/RIOT-mutate-samr21/sys/xtimer/xtimer_core.c
error: Compile error in /home/pokgak/git/RIOT-mutate-samr21/sys/xtimer/xtimer_core.c. Skipping
info: Removing metadata
info: Updating files
info: Resetting timeout context
info: Updating metadata
info: Pruning the database of dropped files
info: Removing orphaned mutants
info: Prune schematas
info: Updating manually marked mutants
info: Committing changes
info: Ok

from dextool.

joakim-brannstrom avatar joakim-brannstrom commented on June 21, 2024

Thank you for the report. I'll see if I can reproduce it locally.
Yes dextool uses clang to parse the source code which mean that what is analyzed must at least pass the semantic passes of clang

from dextool.

joakim-brannstrom avatar joakim-brannstrom commented on June 21, 2024

You could try taking the offending file from the compile commands.json and call clang with it. If clang prints more info I can fix it in dextool. If clang fails...

from dextool.

joakim-brannstrom avatar joakim-brannstrom commented on June 21, 2024

I compiled dextool from source and currently on version dextool version v2.2.0-90-ge02897bd. This is also the same in v2.2.0 tag.

I recommend updating to latest on master so you get the other bug fixes for the analyzer (hang on certain C macros). It shouldn't be related to this issue, I think.

from dextool.

joakim-brannstrom avatar joakim-brannstrom commented on June 21, 2024

Unfortantly I where wrong. openssl worked as expected. It was just a case of multithreaded trashing of the console (--threads 1) solved that.
I have cloned the RIOT repo from github and analyzed the timer_periodic_wakeup example:

cd examples/timer_periodic_wakeup
bear make
dextool mutate admin --init

Changing the config values:

root = "../.."
search_paths = ["./compile_commands.json"]
# I added -Wformat
filter = [....., "-Wformat"]
.......
info: Analyzing /home/joker/src/misc/riot/sys/xtimer/xtimer.c
error: /home/joker/src/misc/riot/sys/xtimer/xtimer.c:280:9: error: address argument to atomic operation must be a pointer to a trivially-copyable type ('_Atomic(short) *' invalid)
error: Compile error in /home/joker/src/misc/riot/sys/xtimer/xtimer.c. Skipping
...

I am using libclang-10 hmm.

from dextool.

pokgak avatar pokgak commented on June 21, 2024

hmm I'll test it again on my system later

from dextool.

pokgak avatar pokgak commented on June 21, 2024

Unfortunately, I haven't got time to look at this anymore. It might be just the setup on my laptop. So I'll close this issue. Thanks @joakim-brannstrom for your time and patience :)

from dextool.

joakim-brannstrom avatar joakim-brannstrom commented on June 21, 2024

No problem, it is fun to see it being used outside the company. Thank you for the valuable feedback.

from dextool.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.