Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.8.1 #50

Merged
merged 4 commits into from
Dec 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.8.1] - 2023-12-25

### Changed

- Minor cleanups on Rust code.
- Enabled `-Werror=type-limits` in the Makefile.

### Fixed

- `getBranchVramGeneric` returns an unsigned type instead of a signed one.

## [1.8.0] - 2023-11-12

### Added
Expand Down Expand Up @@ -489,6 +500,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- First version

[unreleased]: https://github.com/Decompollaborate/rabbitizer/compare/master...develop
[1.8.1]: https://github.com/Decompollaborate/rabbitizer/compare/1.8.0...1.8.1
[1.8.0]: https://github.com/Decompollaborate/rabbitizer/compare/1.7.10...1.8.0
[1.7.10]: https://github.com/Decompollaborate/rabbitizer/compare/1.7.9...1.7.10
[1.7.9]: https://github.com/Decompollaborate/rabbitizer/compare/1.7.8...1.7.9
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[package]
name = "rabbitizer"
# Version should be synced with include/common/RabbitizerVersion.h
version = "1.8.0"
version = "1.8.1"
edition = "2021"
authors = ["Anghelo Carvajal <[email protected]>"]
description = "MIPS instruction decoder"
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ WARNINGS += -Wformat=2 -Wundef
WARNINGS += -Werror=vla -Werror=switch -Werror=implicit-fallthrough -Werror=unused-function
WARNINGS += -Werror=unused-parameter -Werror=shadow -Werror=switch -Werror=double-promotion
WARNINGS_C := -Werror=implicit-function-declaration -Werror=incompatible-pointer-types
WARNINGS += -Werror=type-limits
WARNINGS_CXX :=

ifeq ($(CC),gcc)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ cargo add rabbitizer
Or you can add it manually to your `Cargo.toml`:

```toml
rabbitizer = "1.8.0"
rabbitizer = "1.8.1"
```

See this crate at <https://crates.io/crates/rabbitizer>.
Expand Down
2 changes: 1 addition & 1 deletion cplusplus/include/instructions/InstructionBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ namespace rabbitizer {
//! @deprecated
int32_t getGenericBranchOffset(uint32_t currentVram) const;
int32_t getBranchOffsetGeneric() const;
int32_t getBranchVramGeneric() const;
uint32_t getBranchVramGeneric() const;
int8_t getDestinationGpr() const;
bool outputsToGprZero() const;

Expand Down
2 changes: 1 addition & 1 deletion cplusplus/src/instructions/InstructionBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ int32_t InstructionBase::getBranchOffsetGeneric() const {

return RabbitizerInstruction_getBranchOffsetGeneric(&this->instr);
}
int32_t InstructionBase::getBranchVramGeneric() const {
uint32_t InstructionBase::getBranchVramGeneric() const {
#ifdef RAB_SANITY_CHECKS
if (!hasOperandAlias(OperandType::cpu_branch_target_label) && !hasOperandAlias(OperandType::cpu_label)) {
// TODO: make a rabbitizer exception class
Expand Down
4 changes: 2 additions & 2 deletions docs/usage_c_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ following code:
```c
if (RabbitizerInstrDescriptor_isBranch(instr.descriptor)) {
int32_t vramTarget = RabbitizerInstruction_getBranchVramGeneric(&instr);
uint32_t vramTarget = RabbitizerInstruction_getBranchVramGeneric(&instr);
sprintf(immOverride, ".L%08X", vramTarget);
} else if (RabbitizerInstrDescriptor_canBeHi(instr.descriptor)) {
Expand Down Expand Up @@ -472,7 +472,7 @@ int main(int argc, char *argv[]) {
printf("The word %08X corresponds to the instruction (with immediate overriden):\n", word);

if (RabbitizerInstrDescriptor_isBranch(instr.descriptor)) {
int32_t vramTarget = RabbitizerInstruction_getBranchVramGeneric(&instr);
uint32_t vramTarget = RabbitizerInstruction_getBranchVramGeneric(&instr);

sprintf(immOverride, ".L%08X", vramTarget);
} else if (RabbitizerInstrDescriptor_canBeHi(instr.descriptor)) {
Expand Down
2 changes: 1 addition & 1 deletion include/common/RabbitizerVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extern "C" {
// Header version
#define RAB_VERSION_MAJOR 1
#define RAB_VERSION_MINOR 8
#define RAB_VERSION_PATCH 0
#define RAB_VERSION_PATCH 1

#define RAB_VERSION_STR RAB_STRINGIFY(RAB_VERSION_MAJOR) "." RAB_STRINGIFY(RAB_VERSION_MINOR) "." RAB_STRINGIFY(RAB_VERSION_PATCH)

Expand Down
2 changes: 1 addition & 1 deletion include/instructions/RabbitizerInstruction.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ int32_t RabbitizerInstruction_getGenericBranchOffset(const RabbitizerInstruction
NODISCARD NON_NULL(1) PURE
int32_t RabbitizerInstruction_getBranchOffsetGeneric(const RabbitizerInstruction *self);
NODISCARD NON_NULL(1) PURE
int32_t RabbitizerInstruction_getBranchVramGeneric(const RabbitizerInstruction *self);
uint32_t RabbitizerInstruction_getBranchVramGeneric(const RabbitizerInstruction *self);
NODISCARD NON_NULL(1) PURE
int8_t RabbitizerInstruction_getDestinationGpr(const RabbitizerInstruction *self);
NODISCARD NON_NULL(1) PURE
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[project]
name = "rabbitizer"
# Version should be synced with include/common/RabbitizerVersion.h
version = "1.8.0"
version = "1.8.1"
description = "MIPS instruction decoder"
# license = "MIT"
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion rabbitizer/rabbitizer_type_Instruction.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ static PyObject *rabbitizer_type_Instruction_getGenericBranchOffset(PyRabbitizer
}

DEF_METHOD_GET_INT(getBranchOffsetGeneric)
DEF_METHOD_GET_INT(getBranchVramGeneric)
DEF_METHOD_GET_UINT(getBranchVramGeneric)

static PyObject *rabbitizer_type_Instruction_getDestinationGpr(PyRabbitizerInstruction *self, UNUSED PyObject *closure) {
int8_t reg = RabbitizerInstruction_getDestinationGpr(&self->instr);
Expand Down
8 changes: 4 additions & 4 deletions rust/src/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ extern "C" {
fn RabbitizerInstruction_getBranchOffset(self_: *const Instruction) -> i32;

fn RabbitizerInstruction_getBranchOffsetGeneric(self_: *const Instruction) -> i32;
fn RabbitizerInstruction_getBranchVramGeneric(self_: *const Instruction) -> i32;
fn RabbitizerInstruction_getBranchVramGeneric(self_: *const Instruction) -> u32;
fn RabbitizerInstruction_getDestinationGpr(self_: *const Instruction) -> i8;
fn RabbitizerInstruction_outputsToGprZero(self_: *const Instruction) -> bool;
fn RabbitizerInstruction_blankOut(self_: *mut Instruction);
Expand Down Expand Up @@ -491,7 +491,7 @@ impl Instruction {
unsafe { RabbitizerInstruction_getBranchOffsetGeneric(self) }
}

pub fn branch_vram_generic(&self) -> i32 {
pub fn branch_vram_generic(&self) -> u32 {
unsafe { RabbitizerInstruction_getBranchVramGeneric(self) }
}
pub fn destination_gpr(&self) -> Option<u32> {
Expand Down Expand Up @@ -562,11 +562,11 @@ impl Instruction {
}

pub fn get_operand_type(&self, index: usize) -> operand_type_enum::OperandType {
unsafe { self.descriptor.as_ref().unwrap().get_operand_type(index) }
unsafe { &*self.descriptor }.get_operand_type(index)
}

pub fn get_operands_slice(&self) -> &[operand_type_enum::OperandType] {
unsafe { self.descriptor.as_ref().unwrap().operands_slice() }
unsafe { &*self.descriptor }.operands_slice()
}

pub fn instr_suffix(&self) -> instr_suffix_enum::InstrSuffix {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ int32_t RabbitizerInstruction_getBranchOffsetGeneric(const RabbitizerInstruction
return RabbitizerInstruction_getBranchOffset(self);
}

int32_t RabbitizerInstruction_getBranchVramGeneric(const RabbitizerInstruction *self) {
uint32_t RabbitizerInstruction_getBranchVramGeneric(const RabbitizerInstruction *self) {
if (RabbitizerInstruction_hasOperandAlias(self, RAB_OPERAND_cpu_label)) {
return RabbitizerInstruction_getInstrIndexAsVram(self);
}
Expand Down
Loading