Merge "Replace macro arguments when applying replaceTokens" into main am: 2f993a51bd am: 61124943f8

Original change: https://android-review.googlesource.com/c/platform/bionic/+/2792161

Change-Id: If1bb8b5e38c3218766d53c5d4c1695c30e0a2f40
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Edward Liaw 2023-10-17 21:04:18 +00:00 committed by Automerger Merge Worker
commit dccb59f76d
2 changed files with 14 additions and 5 deletions

View file

@ -1471,9 +1471,18 @@ class BlockList(object):
made_change = True
i += 1
if b.isDefine() and b.define_id in replacements:
b.define_id = replacements[b.define_id]
made_change = True
if b.isDefine():
tokens = CppStringTokenizer(b.define_id).tokens
id_change = False
for tok in tokens:
if tok.kind == TokenKind.IDENTIFIER:
if tok.id in replacements:
tok.id = replacements[tok.id]
id_change = True
if id_change:
b.define_id = ''.join([tok.id for tok in tokens])
made_change = True
if made_change and b.isIf():
# Keep 'expr' in sync with 'tokens'.

View file

@ -65,6 +65,6 @@ static __always_inline __u16 ioprio_value(int __linux_class, int level, int hint
if(IOPRIO_BAD_VALUE(__linux_class, IOPRIO_NR_CLASSES) || IOPRIO_BAD_VALUE(level, IOPRIO_NR_LEVELS) || IOPRIO_BAD_VALUE(hint, IOPRIO_NR_HINTS)) return IOPRIO_CLASS_INVALID << IOPRIO_CLASS_SHIFT;
return(__linux_class << IOPRIO_CLASS_SHIFT) | (hint << IOPRIO_HINT_SHIFT) | level;
}
#define IOPRIO_PRIO_VALUE(class,level) ioprio_value(__linux_class, level, IOPRIO_HINT_NONE)
#define IOPRIO_PRIO_VALUE_HINT(class,level,hint) ioprio_value(__linux_class, level, hint)
#define IOPRIO_PRIO_VALUE(__linux_class,level) ioprio_value(__linux_class, level, IOPRIO_HINT_NONE)
#define IOPRIO_PRIO_VALUE_HINT(__linux_class,level,hint) ioprio_value(__linux_class, level, hint)
#endif