Powered by Linux
Using smatch on Chrome OS kernel, cannot process "__restrict__" — Semantic Matching Tool

Using smatch on Chrome OS kernel, cannot process "__restrict__"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I am trying to apply smatch to the Chrome OS kernel, which is a
modified Linux Kernel 3.4.  There is one "error" that smatch is having
trouble processing.  It is in drivers/md/dm-bht.c:

    sprintf((char *__restrict__)hex, "%02hhx", (int)*binary);

The word "__restrict__" is throwing off smatch somehow and it causes
the build to fail.

When I run make without smatch, the build passes.
When remove the "__restrict__" and make CHECK=smatch, the build passes.

I am new to using smatch so I am not sure how it is processing this
code.  Please take a look at the output below and let me know if
there's something that can be fixed or tweaked in smatch.

Thanks in advance.

Simon



Here is the relevant output from make/smatch:

/home/sque/trunk/src/third_party/kernel/files/drivers/md/dm-bht.c:62:32:
error: Expected ) at end of cast operator
/home/sque/trunk/src/third_party/kernel/files/drivers/md/dm-bht.c:62:32:
error: got __restrict__
/bin/sh: line 1: 12504 Segmentation fault      (core dumped)
/home/sque/trunk/src/smatch/smatch -p=kernel -D__linux__ -Dlinux
-D__STDC__ -Dunix -D__unix__ -Wbitwise -Wno-return-void -D__x86_64__
-m64 -nostdinc -isystem
/usr/lib/gcc/x86_64-cros-linux-gnu/4.7.x-google/include
-Wp,-MD,drivers/md/.dm-bht.o.d -nostdinc -isystem
/usr/lib/gcc/x86_64-cros-linux-gnu/4.7.x-google/include
-I/home/sque/trunk/src/third_party/kernel/files/arch/x86/include
-Iarch/x86/include/generated -Iinclude
-I/home/sque/trunk/src/third_party/kernel/files/include -include
/home/sque/trunk/src/third_party/kernel/files/include/linux/kconfig.h
-I/home/sque/trunk/src/third_party/kernel/files/drivers/md
-Idrivers/md -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes
-Wno-trigraphs -fno-strict-aliasing -fno-common
-Werror-implicit-function-declaration -Wno-format-security
-fno-delete-null-pointer-checks -Os -m64 -mtune=generic -mno-red-zone
-mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args
-fstack-protector -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1
-DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -pipe
-Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx
-mno-sse2 -mno-3dnow -mno-avx -Wframe-larger-than=2048
-Wno-unused-but-set-variable -fno-omit-frame-pointer
-fno-optimize-sibling-calls -pg -Wdeclaration-after-statement
-Wno-pointer-sign -fno-strict-overflow -fconserve-stack
-DCC_HAVE_ASM_GOTO -D"KBUILD_STR(s)=#s"
-D"KBUILD_BASENAME=KBUILD_STR(dm_bht)"
-D"KBUILD_MODNAME=KBUILD_STR(dm_bht)"
/home/sque/trunk/src/third_party/kernel/files/drivers/md/dm-bht.c
--
To unsubscribe from this list: send the line "unsubscribe smatch" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux