Skip to content

Commit

Permalink
[translation] Silence some C++ compile warnings
Browse files Browse the repository at this point in the history
By changing Python code
  • Loading branch information
Andy C committed Aug 10, 2023
1 parent 14bcde8 commit 2cd2aaf
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion cpp/embedded_file_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def main(argv):

# Invoked with _devbuild/help/* stdlib/*.ysh

log('paths %s', paths)
#log('paths %s', paths)

out_f.write('''
#include "cpp/embedded_file.h"
Expand Down
1 change: 1 addition & 0 deletions data_lang/j8.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,3 +290,4 @@ def Parse(self, s):
"""
# TODO: feed it to lexer first, then parser
return None
19 changes: 9 additions & 10 deletions frontend/typed_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,49 +105,48 @@ def __init__(self, pos_args, named_args):

def Word(self):
# type: () -> str
pass
return None # TODO

def RestWords(self):
# type: () -> List[str]
pass
return None # TODO

### Typed positional args

# TODO: may need location info
def PosStr(self):
# type: () -> str
pass
return None # TODO

def PosInt(self):
# type: () -> int
pass
return -1 # TODO

def RestPos(self):
# type: () -> List[value_t]
pass
return None # TODO

### Typed named args

def NamedStr(self, param_name, default_):
# type: (str, str) -> str
pass
return None # TODO

def NamedInt(self, param_name, default_):
# type: (str, int) -> int
pass
return -1 # TODO

def RestNamed(self):
# type: () -> Dict[str, value_t]
pass
return None # TODO

def Block(self):
# type: () -> command_t
"""
Block arg for proc
"""

# TODO: is this BraceGroup?
pass
return None # TODO

def Done(self):
# type: () -> None
Expand Down
6 changes: 6 additions & 0 deletions ysh/expr_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ def _EvalPlaceExpr(self, place):
else:
raise NotImplementedError(place)

raise AssertionError() # silence C++ compiler

def EvalPlaceExpr(self, place):
# type: (place_expr_t) -> lvalue_t
"""Public API for _EvalPlaceExpr to ensure command_sub_errexit"""
Expand Down Expand Up @@ -479,6 +481,8 @@ def _ArithNumeric(self, left, right, op):
else:
raise error.InvalidType('Expected Int or Float', loc.Missing)

raise AssertionError() # silence C++ compiler

def _ArithDivideInt(self, left, right):
# type: (value_t, value_t) -> value.Int
left_i = self._ValueToInteger(left)
Expand Down Expand Up @@ -683,6 +687,8 @@ def _CompareNumeric(self, left, right, op):
raise error.InvalidType('Expected Int or Float operands',
loc.Missing)

raise AssertionError() # silence C++ compiler

def _EvalCompare(self, node):
# type: (expr.Compare) -> value_t

Expand Down

0 comments on commit 2cd2aaf

Please sign in to comment.