mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-07-31 16:27:49 +00:00
- strips out gcc's __attribute__ tags
git-svn-id: http://cmock.svn.sourceforge.net/svnroot/cmock/trunk@223 bf332499-1b4d-0410-844d-d2d48d5cc64c
This commit is contained in:
@@ -66,6 +66,9 @@ class CMockHeaderParser
|
||||
# remove assembler pragma sections
|
||||
source.gsub!(/^\s*#\s*pragma\s+asm\s+.*?#\s*pragma\s+endasm/m, '')
|
||||
|
||||
# remove gcc's __attribute__ tags
|
||||
source.gsub(/__attrbute__\s*\(\(\.*\)\)/, '')
|
||||
|
||||
# remove preprocessor statements and extern "C"
|
||||
source.gsub!(/^\s*#.*/, '')
|
||||
source.gsub!(/extern\s+\"C\"\s+\{/, '')
|
||||
|
||||
@@ -85,6 +85,26 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
||||
end
|
||||
|
||||
|
||||
should "remove gcc's function __attribute__'s" do
|
||||
source =
|
||||
"void* my_calloc(size_t, size_t) __attribute__((alloc_size(1,2)));\n" +
|
||||
"void\n" +
|
||||
" my_realloc(void*, size_t) __attribute__((alloc_size(2)));\n" +
|
||||
"extern int\n" +
|
||||
" my_printf (void *my_object, const char *my_format, ...)\n" +
|
||||
" __attribute__ ((format (printf, 2, 3)));\n" +
|
||||
" void __attribute__ ((interrupt)) universal_handler ();\n"
|
||||
|
||||
expected =
|
||||
[
|
||||
"void* my_calloc(size_t, size_t)",
|
||||
"void my_realloc(void*, size_t)",
|
||||
"void universal_handler()"
|
||||
]
|
||||
|
||||
assert_equal(expected, @parser.import_source(source))
|
||||
end
|
||||
|
||||
should "remove preprocessor directives" do
|
||||
source =
|
||||
"#when stuff_happens\n" +
|
||||
|
||||
Reference in New Issue
Block a user