Commit 7d6beb3f authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

Add script to auto-generate object-macros-undef.h

We were missing a few undefs there. Add a script to auto-generate
object-macros-undef.h from object-macros.h and update
object-macros-undef.h with the output of that script.

R=marja@chromium.org

Bug: v8:5402, v8:8238
Change-Id: I6917940dcbfdf68039a25dc7fb8c219fe55adb10
Reviewed-on: https://chromium-review.googlesource.com/c/1345991Reviewed-by: 's avatarMarja Hölttä <marja@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57728}
parent 69cec109
......@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Generate this file using the update-object-macros-undef.py script.
// PRESUBMIT_INTENTIONALLY_MISSING_INCLUDE_GUARD
#undef OBJECT_CONSTRUCTORS
......@@ -11,6 +13,9 @@
#undef DECL_PRIMITIVE_ACCESSORS
#undef DECL_BOOLEAN_ACCESSORS
#undef DECL_INT_ACCESSORS
#undef DECL_INT32_ACCESSORS
#undef DECL_UINT16_ACCESSORS
#undef DECL_UINT8_ACCESSORS
#undef DECL_ACCESSORS
#undef DECL_ACCESSORS2
#undef DECL_CAST
......@@ -18,12 +23,19 @@
#undef CAST_ACCESSOR
#undef CAST_ACCESSOR2
#undef INT_ACCESSORS
#undef INT32_ACCESSORS
#undef RELAXED_INT32_ACCESSORS
#undef UINT16_ACCESSORS
#undef UINT8_ACCESSORS
#undef ACCESSORS_CHECKED2
#undef ACCESSORS_CHECKED
#undef ACCESSORS
#undef ACCESSORS2
#undef WEAK_ACCESSORS_CHECKED
#undef SYNCHRONIZED_ACCESSORS_CHECKED2
#undef SYNCHRONIZED_ACCESSORS_CHECKED
#undef SYNCHRONIZED_ACCESSORS
#undef WEAK_ACCESSORS_CHECKED2
#undef WEAK_ACCESSORS_CHECKED
#undef WEAK_ACCESSORS
#undef SMI_ACCESSORS_CHECKED
#undef SMI_ACCESSORS
......@@ -39,6 +51,7 @@
#undef READ_WEAK_FIELD
#undef ACQUIRE_READ_FIELD
#undef RELAXED_READ_FIELD
#undef RELAXED_READ_WEAK_FIELD
#undef WRITE_FIELD
#undef WRITE_WEAK_FIELD
#undef RELEASE_WRITE_FIELD
......@@ -51,15 +64,19 @@
#undef WRITE_DOUBLE_FIELD
#undef READ_INT_FIELD
#undef WRITE_INT_FIELD
#undef READ_INTPTR_FIELD
#undef WRITE_INTPTR_FIELD
#undef ACQUIRE_READ_INTPTR_FIELD
#undef RELAXED_READ_INTPTR_FIELD
#undef READ_INTPTR_FIELD
#undef RELEASE_WRITE_INTPTR_FIELD
#undef RELAXED_WRITE_INTPTR_FIELD
#undef WRITE_INTPTR_FIELD
#undef READ_UINTPTR_FIELD
#undef WRITE_UINTPTR_FIELD
#undef READ_UINT8_FIELD
#undef WRITE_UINT8_FIELD
#undef RELAXED_WRITE_INT8_FIELD
#undef READ_INT8_FIELD
#undef RELAXED_READ_INT8_FIELD
#undef WRITE_INT8_FIELD
#undef READ_UINT16_FIELD
#undef WRITE_UINT16_FIELD
......@@ -68,7 +85,9 @@
#undef READ_UINT32_FIELD
#undef WRITE_UINT32_FIELD
#undef READ_INT32_FIELD
#undef RELAXED_READ_INT32_FIELD
#undef WRITE_INT32_FIELD
#undef RELAXED_WRITE_INT32_FIELD
#undef READ_FLOAT_FIELD
#undef WRITE_FLOAT_FIELD
#undef READ_UINT64_FIELD
......
#!/usr/bin/env python3
# Copyright 2018 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# vim:fenc=utf-8:shiftwidth=2:tabstop=2:softtabstop=2:extandtab
"""
Generate object-macros-undef.h from object-macros.h.
"""
import os.path
import re
import sys
INPUT = 'src/objects/object-macros.h'
OUTPUT = 'src/objects/object-macros-undef.h'
HEADER = """// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Generate this file using the {} script.
// PRESUBMIT_INTENTIONALLY_MISSING_INCLUDE_GUARD
""".format(os.path.basename(__file__))
def main():
if not os.path.isfile(INPUT):
sys.exit("Input file {} does not exist; run this script in a v8 checkout."
.format(INPUT))
if not os.path.isfile(OUTPUT):
sys.exit("Output file {} does not exist; run this script in a v8 checkout."
.format(OUTPUT))
regexp = re.compile('^#define (\w+)')
seen = set()
with open(INPUT, 'r') as infile, open(OUTPUT, 'w') as outfile:
outfile.write(HEADER)
for line in infile:
match = regexp.match(line)
if match and match.group(1) not in seen:
seen.add(match.group(1))
outfile.write('#undef {}\n'.format(match.group(1)))
if __name__ == "__main__":
main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment