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

Update clang-format rules #1629

Merged
merged 11 commits into from
Jan 28, 2025
Prev Previous commit
Next Next commit
Run clang-format on some Bison .y file contents
Rangi42 committed Jan 28, 2025
commit 1587ebb87e2190be43aac0a46510d91998b5b77e
23 changes: 10 additions & 13 deletions src/asm/parser.y
Original file line number Diff line number Diff line change
@@ -9,14 +9,14 @@
#include <string>
#include <vector>

#include "either.hpp"
#include "linkdefs.hpp"

#include "asm/lexer.hpp"
#include "asm/macro.hpp"
#include "asm/rpn.hpp"
#include "asm/section.hpp"

#include "either.hpp"
#include "linkdefs.hpp"

struct AlignmentSpec {
uint8_t alignment;
uint16_t alignOfs;
@@ -42,6 +42,7 @@
StrFmtArgList &operator=(StrFmtArgList &&) = default;
};
}

%code {
#include <algorithm>
#include <ctype.h>
@@ -51,6 +52,9 @@
#include <string.h>
#include <string_view>

#include "extern/utf8decoder.hpp"
#include "helpers.hpp"

#include "asm/charmap.hpp"
#include "asm/fixpoint.hpp"
#include "asm/format.hpp"
@@ -62,10 +66,6 @@
#include "asm/symbol.hpp"
#include "asm/warning.hpp"

#include "extern/utf8decoder.hpp"

#include "helpers.hpp"

using namespace std::literals;

yy::parser::symbol_type yylex(); // Provided by lexer.cpp
@@ -77,9 +77,7 @@
static size_t charlenUTF8(std::string const &str);
static std::string charsubUTF8(std::string const &str, uint32_t pos);
static uint32_t adjustNegativePos(int32_t pos, size_t len, char const *functionName);
static std::string strrpl(
std::string_view str, std::string const &old, std::string const &rep
);
static std::string strrpl(std::string_view str, std::string const &old, std::string const &rep);
static std::string strfmt(
std::string const &spec, std::vector<Either<uint32_t, std::string>> const &args
);
@@ -2650,9 +2648,8 @@ static std::string strrpl(std::string_view str, std::string const &old, std::str
return rpl;
}

static std::string strfmt(
std::string const &spec, std::vector<Either<uint32_t, std::string>> const &args
) {
static std::string
strfmt(std::string const &spec, std::vector<Either<uint32_t, std::string>> const &args) {
std::string str;
size_t argIndex = 0;

7 changes: 5 additions & 2 deletions src/link/script.y
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@

void script_ProcessScript(char const *path);
}

%code {
#include <algorithm>
#include <array>
@@ -394,7 +395,8 @@ static void setActiveTypeAndIdx(SectionType type, uint32_t idx) {

static void setFloatingSectionType(SectionType type) {
if (nbbanks(type) == 1) {
setActiveTypeAndIdx(type, 0); // There is only a single bank anyway, so just set the index to 0.
// There is only a single bank anyway, so just set the index to 0.
setActiveTypeAndIdx(type, 0);
} else {
activeType = type;
activeBankIdx = UINT32_MAX;
@@ -634,7 +636,8 @@ static void placeSection(std::string const &name, bool isOptional) {
typeInfo.name.c_str()
);
} else {
// SDCC areas don't have a type assigned yet, so the linker script is used to give them one.
// SDCC areas don't have a type assigned yet, so the linker script is used to give them
// one.
for (Section *fragment = section; fragment; fragment = fragment->nextu.get()) {
fragment->type = activeType;
}