(c) atomic_init
, atomic_xyz
, etc. are all treated as types, but shouldn't be
#3837
Labels
atomic_init
, atomic_xyz
, etc. are all treated as types, but shouldn't be
#3837
Describe the issue
This rule is overly aggressive:
highlight.js/src/languages/c.js
Lines 24 to 31 in 5c1bc1e
As a result, atomic operations such as
atomic_store
,atomic_load
,atomic_init
, etc. are also highlighted as types. Instead of a general rule such asatomic_
being a type,Which language seems to have the issue?
c
Are you using
highlight
orhighlightAuto
?This is just based off of observations on Discord, which, to my knowledge uses highlight.js. Presumably
highlight
.Sample Code to Reproduce
Expected behavior
Only actual typedef-names such as
atomic_int
should be highlighted as types. Functions should not be highlighted as types.Additional context
A list of types and functions can be found here https://en.cppreference.com/w/c/atomic. To fix this, it would not be sufficient to add negative lookahead to the pattern (to exclude function calls), since it is reasonable to write code such as:
To avoid false positives, it would be better to add special cases for all the known
atomic
type aliases (there aren't that many anyway).The text was updated successfully, but these errors were encountered: