Changes in tools/autocheck.awk [8be3230:536ab4f] in mainline


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/autocheck.awk

    r8be3230 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.