Skip to content

Conversation

@Caslyn
Copy link
Contributor

@Caslyn Caslyn commented Nov 25, 2024

gcc interprets a backslash '\' as the last char before a new line as a line continuation character, even in a comment context. This can produce an "error: multi-line comment [-Werror=comment]".

This removes the line continuation so that the comment can compile with gcc.

@Caslyn Caslyn requested a review from lntue November 25, 2024 22:21
@Caslyn Caslyn self-assigned this Nov 25, 2024
@Caslyn Caslyn added the libc label Nov 25, 2024
@llvmbot llvmbot added the libc label Nov 25, 2024
@llvmbot
Copy link
Member

llvmbot commented Nov 25, 2024

@llvm/pr-subscribers-libc

Author: Caslyn Tonelli (Caslyn)

Changes

gcc interprets a backslash '' as the last char before a new line as a line continuation character, even in a comment context. This can produce an "error: multi-line comment [-Werror=comment]".

This removes the line continuation so that the comment can compile with gcc.


Full diff: https://github.com/llvm/llvm-project/pull/117636.diff

1 Files Affected:

  • (modified) libc/src/__support/common.h (+1-2)
diff --git a/libc/src/__support/common.h b/libc/src/__support/common.h
index 79803a346f692e..a9beeb38cc1fa7 100644
--- a/libc/src/__support/common.h
+++ b/libc/src/__support/common.h
@@ -27,8 +27,7 @@
 //
 // For examples:
 // #define LLVM_LIBC_FUNCTION_ATTR_memcpy LLVM_LIBC_EMPTY, [[gnu::weak]]
-// #define LLVM_LIBC_FUNCTION_ATTR_memchr LLVM_LIBC_EMPTY, [[gnu::weak]]       \
-//                                        [[gnu::visibility("default")]]
+// #define LLVM_LIBC_FUNCTION_ATTR_memchr LLVM_LIBC_EMPTY, [[gnu::weak]] [[gnu::visibility("default")]]
 #define LLVM_LIBC_EMPTY
 
 #define GET_SECOND(first, second, ...) second

1 similar comment
@llvmbot
Copy link
Member

llvmbot commented Nov 25, 2024

@llvm/pr-subscribers-libc

Author: Caslyn Tonelli (Caslyn)

Changes

gcc interprets a backslash '' as the last char before a new line as a line continuation character, even in a comment context. This can produce an "error: multi-line comment [-Werror=comment]".

This removes the line continuation so that the comment can compile with gcc.


Full diff: https://github.com/llvm/llvm-project/pull/117636.diff

1 Files Affected:

  • (modified) libc/src/__support/common.h (+1-2)
diff --git a/libc/src/__support/common.h b/libc/src/__support/common.h
index 79803a346f692e..a9beeb38cc1fa7 100644
--- a/libc/src/__support/common.h
+++ b/libc/src/__support/common.h
@@ -27,8 +27,7 @@
 //
 // For examples:
 // #define LLVM_LIBC_FUNCTION_ATTR_memcpy LLVM_LIBC_EMPTY, [[gnu::weak]]
-// #define LLVM_LIBC_FUNCTION_ATTR_memchr LLVM_LIBC_EMPTY, [[gnu::weak]]       \
-//                                        [[gnu::visibility("default")]]
+// #define LLVM_LIBC_FUNCTION_ATTR_memchr LLVM_LIBC_EMPTY, [[gnu::weak]] [[gnu::visibility("default")]]
 #define LLVM_LIBC_EMPTY
 
 #define GET_SECOND(first, second, ...) second

@lntue lntue changed the title Resolve multi-line comment error [libc] Resolve multi-line comment error Nov 25, 2024
@github-actions
Copy link

github-actions bot commented Nov 25, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

@Caslyn
Copy link
Contributor Author

Caslyn commented Nov 25, 2024

Disabled clang-format on the comment allow the longer line to demonstrate multiple attributes.

@Caslyn Caslyn merged commit 4c91662 into llvm:main Nov 25, 2024
5 of 6 checks passed
@Caslyn Caslyn deleted the fix-comment branch November 25, 2024 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants