Skip to content

Commit

Permalink
Merge pull request #9385 from jakobandersen/cpp_update_version
Browse files Browse the repository at this point in the history
C++, fixes for recent additions
  • Loading branch information
jakobandersen committed Jun 28, 2021
2 parents b187ca0 + 358efdd commit 805fd98
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions sphinx/domains/cpp.py
Expand Up @@ -869,7 +869,7 @@ def _stringify(self, transform: StringifyTransform) -> str:

def get_id(self, version: int) -> str:
# TODO: floats should be mangled by writing the hex of the binary representation
return "L%sE" % self.data
return "L%sE" % self.data.replace("'", "")

def describe_signature(self, signode: TextElement, mode: str,
env: "BuildEnvironment", symbol: "Symbol") -> None:
Expand Down Expand Up @@ -7895,7 +7895,7 @@ def initStuff(app):

return {
'version': 'builtin',
'env_version': 3,
'env_version': 4,
'parallel_read_safe': True,
'parallel_write_safe': True,
}
18 changes: 9 additions & 9 deletions tests/test_domain_cpp.py
Expand Up @@ -182,9 +182,9 @@ class Config:
for u in unsignedSuffix:
for l in longSuffix:
expr = i + u + l
exprCheck(expr, 'L' + expr + 'E')
exprCheck(expr, 'L' + expr.replace("'", "") + 'E')
expr = i + l + u
exprCheck(expr, 'L' + expr + 'E')
exprCheck(expr, 'L' + expr.replace("'", "") + 'E')
decimalFloats = ['5e42', '5e+42', '5e-42',
'5.', '5.e42', '5.e+42', '5.e-42',
'.5', '.5e42', '.5e+42', '.5e-42',
Expand All @@ -200,10 +200,10 @@ class Config:
for suffix in ['', 'f', 'F', 'l', 'L']:
for e in decimalFloats:
expr = e + suffix
exprCheck(expr, 'L' + expr + 'E')
exprCheck(expr, 'L' + expr.replace("'", "") + 'E')
for e in hexFloats:
expr = "0x" + e + suffix
exprCheck(expr, 'L' + expr + 'E')
exprCheck(expr, 'L' + expr.replace("'", "") + 'E')
exprCheck('"abc\\"cba"', 'LA8_KcE') # string
exprCheck('this', 'fpT')
# character literals
Expand All @@ -216,13 +216,13 @@ class Config:
exprCheck("{}'{}'".format(p, c), t + val)
# user-defined literals
for i in ints:
exprCheck(i + '_udl', 'clL_Zli4_udlEL' + i + 'EE')
exprCheck(i + 'uludl', 'clL_Zli5uludlEL' + i + 'EE')
exprCheck(i + '_udl', 'clL_Zli4_udlEL' + i.replace("'", "") + 'EE')
exprCheck(i + 'uludl', 'clL_Zli5uludlEL' + i.replace("'", "") + 'EE')
for f in decimalFloats:
exprCheck(f + '_udl', 'clL_Zli4_udlEL' + f + 'EE')
exprCheck(f + 'fudl', 'clL_Zli4fudlEL' + f + 'EE')
exprCheck(f + '_udl', 'clL_Zli4_udlEL' + f.replace("'", "") + 'EE')
exprCheck(f + 'fudl', 'clL_Zli4fudlEL' + f.replace("'", "") + 'EE')
for f in hexFloats:
exprCheck('0x' + f + '_udl', 'clL_Zli4_udlEL0x' + f + 'EE')
exprCheck('0x' + f + '_udl', 'clL_Zli4_udlEL0x' + f.replace("'", "") + 'EE')
for p, t in charPrefixAndIds:
for c, val in chars:
exprCheck("{}'{}'_udl".format(p, c), 'clL_Zli4_udlE' + t + val + 'E')
Expand Down

0 comments on commit 805fd98

Please sign in to comment.