-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[support][nfc] MD5: Undef macros after use #132132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I'm experimenting with amalgamating Support lib into single cpp and leaking a bunch of 1-letter macros is not nice.
@llvm/pr-subscribers-llvm-support Author: Ivan Butygin (Hardcode84) ChangesI'm experimenting with amalgamating Support lib into single cpp and leaking a bunch of 1-letter macros is not nice. Full diff: https://github.com/llvm/llvm-project/pull/132132.diff 1 Files Affected:
diff --git a/llvm/lib/Support/MD5.cpp b/llvm/lib/Support/MD5.cpp
index ef7f559adf064..3bff4e177f781 100644
--- a/llvm/lib/Support/MD5.cpp
+++ b/llvm/lib/Support/MD5.cpp
@@ -296,3 +296,11 @@ MD5::MD5Result MD5::hash(ArrayRef<uint8_t> Data) {
return Res;
}
+
+#undef F
+#undef G
+#undef H
+#undef I
+#undef STEP
+#undef SET
+#undef GET
|
@@ -296,3 +296,11 @@ MD5::MD5Result MD5::hash(ArrayRef<uint8_t> Data) { | |||
|
|||
return Res; | |||
} | |||
|
|||
#undef F |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it would be reasonable to upgrade these macros to constexpr
functions instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, but I don't think this is a blocker
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Searching them on github gives a lot of hits, so they were probably copypasted from some common place: https://github.com/search?q=%23define+F%28x%2C+y%2C+z%29+%28%28z%29+%5E+%28%28x%29+%26+%28%28y%29+%5E+%28z%29%29%29%29&type=code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but it would be nice not to use macros at all
@@ -296,3 +296,11 @@ MD5::MD5Result MD5::hash(ArrayRef<uint8_t> Data) { | |||
|
|||
return Res; | |||
} | |||
|
|||
#undef F |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, but I don't think this is a blocker
I'm experimenting with amalgamating Support lib into single cpp and leaking a bunch of 1-letter macros is not nice.