Changeset 536ab4f in mainline


Ignore:
Timestamp:
2019-06-25T14:10:35Z (5 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c486f83
Parents:
093e956
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2019-06-25 12:47:52)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2019-06-25 14:10:35)
Message:

tools/autocheck.awk: Remove dependency on build path

Instead of #including the header, inline it into the file for greater
flexibility.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/autocheck.awk

    r093e956 r536ab4f  
    3333BEGIN {
    3434        filename = ARGV[1]
     35        output_lines = 0
    3536        print "// Generated file. Fix the included header if static assert fails."
    36         print "#include \"" filename "\""
     37        print "// Inlined \"" filename "\""
     38}
     39
     40{
     41        print $0
    3742}
    3843
     
    4449        }
    4550        macro_name = toupper(struct_name) "_SIZE"
    46         print "_Static_assert(" macro_name " == sizeof(struct " struct_name "), \"\");"
     51        output[output_lines++] = "_Static_assert(" macro_name " == sizeof(struct " struct_name "), \"\");"
    4752        struct_name = ""
    4853}
     
    5560
    5661                macro_name = toupper(struct_name) "_OFFSET_" toupper(member)
    57                 print "_Static_assert(" macro_name " == __builtin_offsetof(struct " struct_name ", " member "), \"\");"
     62                output[output_lines++] = "_Static_assert(" macro_name " == __builtin_offsetof(struct " struct_name ", " member "), \"\");"
    5863
    5964                macro_name = toupper(struct_name) "_SIZE_" toupper(member)
    60                 print "#ifdef " macro_name
    61                 print "_Static_assert(" macro_name " == sizeof(((struct " struct_name "){ })." member "), \"\");"
    62                 print "#endif"
     65                output[output_lines++] = "#ifdef " macro_name
     66                output[output_lines++] = "_Static_assert(" macro_name " == sizeof(((struct " struct_name "){ })." member "), \"\");"
     67                output[output_lines++] = "#endif"
    6368        }
    6469}
     
    6772        struct_name = $3
    6873}
     74
     75END {
     76        for ( i = 0; i < output_lines; i++ ) {
     77                print output[i]
     78        }
     79}
Note: See TracChangeset for help on using the changeset viewer.