Skip to content

Commit

Permalink
Merge pull request #147 from chaoticgd/names
Browse files Browse the repository at this point in the history
Update licensing documentation, improve some comments/names
  • Loading branch information
chaoticgd authored Jan 9, 2024
2 parents 324b94e + 61b3a69 commit 80410de
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 20 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ set(RELEASE_CONTENTS
"${CMAKE_SOURCE_DIR}/ghidra_scripts/CCCDecompileAllFunctions.java"
"${CMAKE_SOURCE_DIR}/README.md"
"${CMAKE_SOURCE_DIR}/License.txt"
"${CMAKE_SOURCE_DIR}/thirdparty/demanglegnu/DemanglerLicense.txt"
"${CMAKE_SOURCE_DIR}/thirdparty/demanglegnu/DemanglerLicenseSupplementGPL.txt"
"${CMAKE_SOURCE_DIR}/thirdparty/demanglegnu/DemanglerLicenseGPL.txt"
"${CMAKE_SOURCE_DIR}/thirdparty/demanglegnu/DemanglerLicenseLGPL.txt"
"${CMAKE_SOURCE_DIR}/thirdparty/googletest/GoogleTestLicense.txt"
"${CMAKE_SOURCE_DIR}/thirdparty/rapidjson/RapidJSONLicense.txt"
)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,4 @@ Use of a code formatter such as `clang-format` or `astyle` on the output is reco

## License

All the code is MIT licensed, with the exception of the code in the `src/demanglegnu` directory, which is taken from the GNU libiberty library and is licensed under the LGPL. This license is included in the form of the `DemanglerLicense.txt` file. A copy of the GNU GPL is also included in the form of the `DemanglerLicenseSupplementGPL.txt` file.
The GNU demangler is used, which contains source files licensed under the GPL and the LGPL. RapidJSON is used under the MIT license. The GoogleTest library is used by the test suite under the 3-Clause BSD license.
3 changes: 1 addition & 2 deletions src/ccc/stabs_to_ast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,7 @@ Result<std::unique_ptr<ast::Node>> stabs_type_to_ast(
CCC_CHECK(end != high, "Failed to parse low part of range as integer.");

if(high_value == 4294967295) {
// Some compilers wrote out a wrapped around value here for zero
// (or variable?) length arrays.
// Some compilers wrote out a wrapped around value here.
array->element_count = 0;
} else {
array->element_count = high_value + 1;
Expand Down
4 changes: 2 additions & 2 deletions src/ccc/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ Error format_error(const char* source_file, int source_line, const char* format,
return error;
}

void report_fatal_error(const Error& error)
void report_error(const Error& error)
{
if(custom_error_callback) {
custom_error_callback(error, ErrorSeverity::FATAL);
custom_error_callback(error, ErrorSeverity::ERROR);
} else {
fprintf(stderr, "[%s:%d] " CCC_ANSI_COLOUR_RED "error:" CCC_ANSI_COLOUR_OFF " %s\n",
error.source_file, error.source_line, error.message.c_str());
Expand Down
10 changes: 5 additions & 5 deletions src/ccc/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,28 +46,28 @@ struct Error {
};

enum class ErrorSeverity {
FATAL,
ERROR,
WARNING
};

typedef void (*CustomErrorCallback)(const Error& error, ErrorSeverity severity);

Error format_error(const char* source_file, int source_line, const char* format, ...);
void report_fatal_error(const Error& error);
void report_error(const Error& error);
void report_warning(const Error& warning);
void set_custom_error_callback(CustomErrorCallback callback);

#define CCC_FATAL(...) \
{ \
ccc::Error error = ccc::format_error(__FILE__, __LINE__, __VA_ARGS__); \
ccc::report_fatal_error(error); \
ccc::report_error(error); \
exit(1); \
}

#define CCC_CHECK_FATAL(condition, ...) \
if(!(condition)) { \
ccc::Error error = ccc::format_error(__FILE__, __LINE__, __VA_ARGS__); \
ccc::report_fatal_error(error); \
ccc::report_error(error); \
exit(1); \
}

Expand Down Expand Up @@ -174,7 +174,7 @@ class [[nodiscard]] Result<void> : public Result<int> {

#define CCC_EXIT_IF_ERROR(result) \
if(!(result).success()) { \
ccc::report_fatal_error((result).error()); \
ccc::report_error((result).error()); \
exit(1); \
}

Expand Down
5 changes: 3 additions & 2 deletions src/stdump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -557,8 +557,9 @@ static void print_help(FILE* out)
fprintf(out, "Importer Options:\n");
print_importer_flags_help(out);
printf("\n");
printf("The demangler library used is licensed under the LGPL, the rest is MIT licensed.\n");
printf("See the License.txt and DemanglerLicense.txt files for more information.\n");
printf("The GNU demangler is used, which contains source files licensed under the GPL\n");
printf("and the LGPL. RapidJSON is used under the MIT license. The GoogleTest library is\n");
printf("used by the test suite under the 3-Clause BSD license.\n");
}

extern const char* git_tag;
Expand Down
5 changes: 3 additions & 2 deletions src/uncc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ static void print_help(int argc, char** argv)
printf("Importer Options:\n");
print_importer_flags_help(stdout);
printf("\n");
printf("The demangler library used is licensed under the LGPL, the rest is MIT licensed.\n");
printf("See the License.txt and DemanglerLicense.txt files for more information.\n");
printf("The GNU demangler is used, which contains source files licensed under the GPL\n");
printf("and the LGPL. RapidJSON is used under the MIT license. The GoogleTest library is\n");
printf("used by the test suite under the 3-Clause BSD license.\n");
}
2 changes: 1 addition & 1 deletion test/ccc/mdebug_importer_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using namespace ccc;
using namespace ccc::mdebug;

// Tests for the whole .mdebug parsing and analysis pipeline. They are based on
// Tests for the whole STABS parsing and analysis pipeline. They are based on
// real compiler outputs from the old homebrew toolchain (GCC 3.2.3) except
// where otherwise stated.

Expand Down
File renamed without changes.
8 changes: 5 additions & 3 deletions thirdparty/demanglegnu/README
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
This code is taken from GNU binutils v2.31 and specifically the libiberty
library which is licensed under the LGPL. Some modifications have been made to
fix a memory safety issue with the cplus_demangle_opname function.
This code was taken from GNU binutils v2.31 and specifically the libiberty
library which contains files licensed under the GPL and the LGPL.

Some modifications have been made to fix a memory safety issue with the
cplus_demangle_opname function.

0 comments on commit 80410de

Please sign in to comment.