Bound a directive only after complete comments/literals, not at a physical * newline inside a block comment. The audit view already has line splices * removed. This locates its extent; tdx_directive validates consumed content. */
| 6112 | * newline inside a block comment. The audit view already has line splices |
| 6113 | * removed. This locates its extent; tdx_directive validates consumed content. */ |
| 6114 | static bool tdx_directive_end(const char *s, size_t n, size_t *at, uint32_t *line) { |
| 6115 | while (*at < n) { |
| 6116 | if (s[*at] == '\0') |
| 6117 | return false; |
| 6118 | if (s[*at] == '\n') { |
| 6119 | (*at)++; |
| 6120 | (*line)++; |
| 6121 | return true; |
| 6122 | } |
| 6123 | if (*at + 1 < n && s[*at] == '/' && s[*at + 1] == '*') { |
| 6124 | *at += 2; |
| 6125 | while (*at + 1 < n && !(s[*at] == '*' && s[*at + 1] == '/')) { |
| 6126 | if (s[*at] == '\0') |
| 6127 | return false; |
| 6128 | if (s[*at] == '\n') |
| 6129 | (*line)++; |
| 6130 | (*at)++; |
| 6131 | } |
| 6132 | if (*at + 1 >= n) |
| 6133 | return false; |
| 6134 | *at += 2; |
| 6135 | continue; |
| 6136 | } |
| 6137 | if (*at + 1 < n && s[*at] == '/' && s[*at + 1] == '/') { |
| 6138 | *at += 2; |
| 6139 | while (*at < n && s[*at] != '\n') { |
| 6140 | if (s[*at] == '\0') |
| 6141 | return false; |
| 6142 | (*at)++; |
| 6143 | } |
| 6144 | continue; |
| 6145 | } |
| 6146 | if (tdx_pp_number(s, n, at)) |
| 6147 | continue; |
| 6148 | if (s[*at] == '"' || s[*at] == '\'') { |
| 6149 | size_t before = *at; |
| 6150 | if (!tdx_audit_literal(s, n, at)) { |
| 6151 | /* Let the consumed-directive parser report malformed literal |
| 6152 | * content. Do not reinterpret its comment punctuation here. */ |
| 6153 | *at = before + 1; |
| 6154 | while (*at < n && s[*at] != '\n') { |
| 6155 | if (s[*at] == '\0') |
| 6156 | return false; |
| 6157 | (*at)++; |
| 6158 | } |
| 6159 | } |
| 6160 | for (size_t i = before; i < *at; i++) |
| 6161 | if (s[i] == '\n') |
| 6162 | (*line)++; |
| 6163 | continue; |
| 6164 | } |
| 6165 | (*at)++; |
| 6166 | } |
| 6167 | return true; |
| 6168 | } |
| 6169 | |
| 6170 | /* A replacement list referring to a configured definition is not a raw test |
| 6171 | * declaration. Surface it as unsupported instead of certifying only the |
no test coverage detected