Skip to content

Commit

Permalink
Merge pull request eclipse-omr#3835 from dnakamura/ddr_undef
Browse files Browse the repository at this point in the history
CMake DDR: Fix bug where #undef statements were not recognized
  • Loading branch information
charliegracie authored May 15, 2019
2 parents e4ae0f5 + b3e7a82 commit 11fc810
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions cmake/modules/ddr/cmake_ddr.awk
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,14 @@ NR == 1 {
# basic line cleanup
{
# replace tabs with spaces, and cut multiple spaces
sub(/[ \t]+/, " ")
#clean up any space between '#' and define
sub(/^ ?# +define/, "#define")

gsub(/[ \t]+/, " ")
# clean up any space between '#' and define
sub(/^ ?# ?define/, "#define")
# Normalize #undefs, ie remove excess spaces, and possible leading '/*'
sub(/^ ?(\/\* ?)?# ?undef/, "#undef")
}

/^# ?define / {
sub(/^ ?# ?define /, "#define ")
/^#define / {
macro_name = $2
# if this is a function style macro, ignore it
if(macro_name ~ /\(/) { next }
Expand All @@ -168,8 +168,6 @@ NR == 1 {
next
}

/^ ?(\/\*)? ?undef )/ {
# strip off leading #undef to get our flag name
sub(/^ ?(\/\*)? ?undef +)/, "", $0)
if(add_flags){undef_flag_macro($1)}
/^#undef / {
if(add_flags){undef_flag_macro($2)}
}

0 comments on commit 11fc810

Please sign in to comment.