Skip to content

Commit

Permalink
DBT format with clang-format 19 (#3264)
Browse files Browse the repository at this point in the history
* DBT format with clang-format 19

* Replace clang-format action with one that support clang-format-19

* Pin to commit
  • Loading branch information
stellar-aria authored Jan 12, 2025
1 parent b1fd780 commit f70949c
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 41 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/format-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Run clang-format style check for C/C++ code
uses: DoozyX/clang-format-lint-action@v0.18
uses: d-griet/clang-format-lint-action@99a106be2f3f1a92d9783ea7c744fde62d8ce1fa
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
source: './src'
extensions: 'c,cpp,h,hpp'
clangFormatVersion: 18
clangFormatVersion: 19
- name: Run Black style check for Python code
uses: psf/black@stable
with:
Expand Down
12 changes: 7 additions & 5 deletions scripts/tasks/task-format.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
import util
from functools import partial

EXEC_EXT = ".exe" if os.name == "nt" else ""
# EXEC_EXT = ".exe" if os.name == "nt" else ""
EXEC_EXT = "" # Disabled until next DBT release

DBT_VERSION = util.get_dbt_version()

Expand Down Expand Up @@ -46,8 +47,9 @@ def exclude(files, excludes):
def get_clang_format_cmd():
tool_path = util.get_git_root() / "toolchain" / f"v{DBT_VERSION}"
for path in tool_path.rglob(f"clang-format{EXEC_EXT}"):
os.environ["PATH"] += os.pathsep + str(path.parent.absolute())
return path
if path.is_file():
os.environ["PATH"] += os.pathsep + str(path.parent.absolute())
return path
# failed to find it in toolchains, falling back to path, then string
return util.find_cmd_with_fallback("clang-format")

Expand Down Expand Up @@ -194,5 +196,5 @@ def main() -> int:
return 0


if __name__ == "__main__":
main()
# if __name__ == "__main__":
# main()
2 changes: 1 addition & 1 deletion src/RZA1/usb/r_usb_basic/src/driver/r_usb_pdriver.c
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ void usb_pstd_set_eptbl_index(uint16_t con_num, uint16_t int_num, uint16_t alt_n

if (j < numbers)
{
ep = (uint16_t) * (uint8_t*)((uint32_t)ptr + (uint32_t)2u);
ep = (uint16_t)*(uint8_t*)((uint32_t)ptr + (uint32_t)2u);
if (USB_EP_IN == (ep & USB_EP_DIRMASK))
{
dir = 1; /* IN */
Expand Down
12 changes: 6 additions & 6 deletions src/RZA1/usb/r_usb_basic/src/hw/inc/r_usb_reg_access.h
Original file line number Diff line number Diff line change
Expand Up @@ -417,16 +417,16 @@ inline static void hw_usb_clear_sts_brdy(usb_utr_t* ptr, uint16_t pipeno)
{
#if ((USB_CFG_MODE & USB_CFG_PERI) == USB_CFG_PERI)
#if USB_CFG_USE_USBIP == USB_CFG_IP0
USB200.BRDYSTS = (uint16_t) ~(1 << pipeno);
USB200.BRDYSTS = (uint16_t)~(1 << pipeno);
#else
USB201.BRDYSTS = (uint16_t) ~(1 << pipeno);
USB201.BRDYSTS = (uint16_t)~(1 << pipeno);
#endif
#endif /* (USB_CFG_MODE & USB_CFG_PERI) == USB_CFG_REPI */
}
else
{
#if ((USB_CFG_MODE & USB_CFG_HOST) == USB_CFG_HOST)
ptr->ipp->BRDYSTS = (uint16_t) ~(1 << pipeno);
ptr->ipp->BRDYSTS = (uint16_t)~(1 << pipeno);
#endif /* (USB_CFG_MODE & USB_CFG_HOST) == USB_CFG_HOST */
}
} /* End of function hw_usb_clear_sts_brdy() */
Expand Down Expand Up @@ -457,16 +457,16 @@ inline static void hw_usb_clear_status_bemp(usb_utr_t* ptr, uint16_t pipeno)
{
#if ((USB_CFG_MODE & USB_CFG_PERI) == USB_CFG_PERI)
#if USB_CFG_USE_USBIP == USB_CFG_IP0
USB200.BEMPSTS = (uint16_t) ~(1 << pipeno);
USB200.BEMPSTS = (uint16_t)~(1 << pipeno);
#else
USB201.BEMPSTS = (uint16_t) ~(1 << pipeno);
USB201.BEMPSTS = (uint16_t)~(1 << pipeno);
#endif
#endif /* (USB_CFG_MODE & USB_CFG_PERI) == USB_CFG_REPI */
}
else
{
#if ((USB_CFG_MODE & USB_CFG_HOST) == USB_CFG_HOST)
ptr->ipp->BEMPSTS = (uint16_t) ~(1 << pipeno);
ptr->ipp->BEMPSTS = (uint16_t)~(1 << pipeno);
#endif /* (USB_CFG_MODE & USB_CFG_HOST) == USB_CFG_HOST */
}
} /* End of function hw_usb_clear_status_bemp() */
Expand Down
6 changes: 3 additions & 3 deletions src/RZA1/usb/r_usb_basic/src/hw/r_usb_creg_access.c
Original file line number Diff line number Diff line change
Expand Up @@ -1555,16 +1555,16 @@ void hw_usb_clear_status_nrdy(usb_utr_t* ptr, uint16_t pipeno)
{
#if ((USB_CFG_MODE & USB_CFG_PERI) == USB_CFG_PERI)
#if USB_CFG_USE_USBIP == USB_CFG_IP0
USB200.NRDYSTS = (uint16_t) ~(1 << pipeno);
USB200.NRDYSTS = (uint16_t)~(1 << pipeno);
#else
USB201.NRDYSTS = (uint16_t) ~(1 << pipeno);
USB201.NRDYSTS = (uint16_t)~(1 << pipeno);
#endif
#endif /* (USB_CFG_MODE & USB_CFG_PERI) == USB_CFG_REPI */
}
else
{
#if ((USB_CFG_MODE & USB_CFG_HOST) == USB_CFG_HOST)
ptr->ipp->NRDYSTS = (uint16_t) ~(1 << pipeno);
ptr->ipp->NRDYSTS = (uint16_t)~(1 << pipeno);
#endif /* (USB_CFG_MODE & USB_CFG_HOST) == USB_CFG_HOST */
}
} /* End of function hw_usb_clear_status_nrdy() */
Expand Down
36 changes: 18 additions & 18 deletions src/RZA1/usb/r_usb_basic/src/hw/r_usb_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ void usb_cstd_DmaxInt(usb_utr_t* ptr, uint16_t pipemode)
if (0u == g_usb_pstd_data_cnt[pipe])
#endif
{
/* FIFO buffer empty flag clear */
/* FIFO buffer empty flag clear */
#if ((USB_CFG_MODE & USB_CFG_HOST) == USB_CFG_HOST)
usb_creg_clr_sts_bemp(ip, pipe);
/* bval control for transfer enable fifo 2 usb control */
Expand All @@ -432,14 +432,14 @@ void usb_cstd_DmaxInt(usb_utr_t* ptr, uint16_t pipemode)
}
else
{
/* update remaining transfer data size */
/* update remaining transfer data size */
#if ((USB_CFG_MODE & USB_CFG_HOST) == USB_CFG_HOST)
g_usb_hstd_data_cnt[ip][pipe] -= g_usb_cstd_dma_size[ip][ch_no];
#endif
#if ((USB_CFG_MODE & USB_CFG_PERI) == USB_CFG_PERI)
g_usb_pstd_data_cnt[pipe] -= g_usb_cstd_dma_size[ip][ch_no];
#endif
/* check transfer remaining data */
/* check transfer remaining data */
#if ((USB_CFG_MODE & USB_CFG_HOST) == USB_CFG_HOST)
if (0u == g_usb_hstd_data_cnt[ip][pipe])
#endif
Expand Down Expand Up @@ -477,7 +477,7 @@ void usb_cstd_DmaxInt(usb_utr_t* ptr, uint16_t pipemode)
if ((usb_creg_read_pipectr(ip, pipe) & USB_INBUFM) != USB_INBUFM)
{
L1_D_CacheWritebackFlushAll();
/* DMA transfer function end. call callback function */
/* DMA transfer function end. call callback function */

#if ((USB_CFG_MODE & USB_CFG_HOST) == USB_CFG_HOST)
usb_hstd_data_end(ptr, pipe, (uint16_t)USB_DATA_NONE);
Expand Down Expand Up @@ -2424,22 +2424,22 @@ uint32_t usb_cstd_GetDXfifoYAdr(uint16_t ip, uint16_t trans_size, uint16_t pipem
{
if (USB_D0DMA == pipemode)
{
ret_address = (uint32_t) & (USB200.D0FIFO.UINT8[3]);
ret_address = (uint32_t)&(USB200.D0FIFO.UINT8[3]);
}
if (USB_D1DMA == pipemode)
{
ret_address = (uint32_t) & (USB200.D1FIFO.UINT8[3]);
ret_address = (uint32_t)&(USB200.D1FIFO.UINT8[3]);
}
}
if (USB_IP1 == ip)
{
if (USB_D0DMA == pipemode)
{
ret_address = (uint32_t) & (USB201.D0FIFO.UINT8[3]);
ret_address = (uint32_t)&(USB201.D0FIFO.UINT8[3]);
}
if (USB_D1DMA == pipemode)
{
ret_address = (uint32_t) & (USB201.D1FIFO.UINT8[3]);
ret_address = (uint32_t)&(USB201.D1FIFO.UINT8[3]);
}
}

Expand All @@ -2451,22 +2451,22 @@ uint32_t usb_cstd_GetDXfifoYAdr(uint16_t ip, uint16_t trans_size, uint16_t pipem
{
if (USB_D0DMA == pipemode)
{
ret_address = (uint32_t) & (USB200.D0FIFO);
ret_address = (uint32_t)&(USB200.D0FIFO);
}
if (USB_D1DMA == pipemode)
{
ret_address = (uint32_t) & (USB200.D1FIFO);
ret_address = (uint32_t)&(USB200.D1FIFO);
}
}
if (USB_IP1 == ip)
{
if (USB_D0DMA == pipemode)
{
ret_address = (uint32_t) & (USB201.D0FIFO);
ret_address = (uint32_t)&(USB201.D0FIFO);
}
if (USB_D1DMA == pipemode)
{
ret_address = (uint32_t) & (USB201.D1FIFO);
ret_address = (uint32_t)&(USB201.D1FIFO);
}
}

Expand All @@ -2478,22 +2478,22 @@ uint32_t usb_cstd_GetDXfifoYAdr(uint16_t ip, uint16_t trans_size, uint16_t pipem
{
if (USB_D0DMA == pipemode)
{
ret_address = (uint32_t) & (USB200.D0FIFOB0);
ret_address = (uint32_t)&(USB200.D0FIFOB0);
}
if (USB_D1DMA == pipemode)
{
ret_address = (uint32_t) & (USB200.D1FIFOB0);
ret_address = (uint32_t)&(USB200.D1FIFOB0);
}
}
if (USB_IP1 == ip)
{
if (USB_D0DMA == pipemode)
{
ret_address = (uint32_t) & (USB201.D0FIFOB0);
ret_address = (uint32_t)&(USB201.D0FIFOB0);
}
if (USB_D1DMA == pipemode)
{
ret_address = (uint32_t) & (USB201.D1FIFOB0);
ret_address = (uint32_t)&(USB201.D1FIFOB0);
}
}

Expand Down Expand Up @@ -2869,11 +2869,11 @@ void usb_creg_clr_sts_bemp(uint16_t ip, uint16_t pipeno)
{
if (USB_IP0 == ip)
{
USB200.BEMPSTS = (uint16_t) ~(1 << pipeno);
USB200.BEMPSTS = (uint16_t)~(1 << pipeno);
}
if (USB_IP1 == ip)
{
USB201.BEMPSTS = (uint16_t) ~(1 << pipeno);
USB201.BEMPSTS = (uint16_t)~(1 << pipeno);
}
} /* End of function usb_creg_clr_sts_bemp() */

Expand Down
2 changes: 1 addition & 1 deletion src/RZA1/usb/r_usb_basic/src/hw/r_usb_hreg_abs.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ int usb_hstd_interrupt_handler(usb_utr_t* ptr)
/* SACK Clear */
ptr->ipp->INTSTS1 = (uint16_t)(~USB_SACK & INTSTS1_MASK);
/* Setup Ignore,Setup Acknowledge disable */
ptr->ipp->INTENB1 &= (uint16_t) ~(USB_SIGNE | USB_SACKE);
ptr->ipp->INTENB1 &= (uint16_t)~(USB_SIGNE | USB_SACKE);
ptr->keyword = USB_INT_SACK;
}
else if (ists1 & USB_SIGN)
Expand Down
4 changes: 2 additions & 2 deletions src/RZA1/usb/r_usb_hmidi/src/r_usb_hmidi_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,8 @@ static void usb_hmidi_enumeration_sequence(usb_utr_t* mess)

p_desc = g_p_usb_hmidi_config_table[mess->ip];

desc_len = ((uint16_t) * (p_desc + 3)) << 8;
desc_len += (uint16_t) * (p_desc + 2);
desc_len = ((uint16_t)*(p_desc + 3)) << 8;
desc_len += (uint16_t)*(p_desc + 2);

/* Searching InterfaceDescriptor */
p_iftable = g_p_usb_hmidi_interface_table[mess->ip];
Expand Down
4 changes: 2 additions & 2 deletions src/deluge/dsp/oscillators/oscillator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Oscillator::renderOsc(OscType type, int32_t amplitude, int32_t* bufferStart, int

int64_t resetterPhaseToDivide = (uint64_t)resetterPhase << 30;

if ((uint32_t)(resetterPhase) >= (uint32_t) - (resetterPhaseIncrement >> 1)) {
if ((uint32_t)(resetterPhase) >= (uint32_t)-(resetterPhaseIncrement >> 1)) {
resetterPhaseToDivide -= (uint64_t)1 << 62;
}

Expand All @@ -113,7 +113,7 @@ Oscillator::renderOsc(OscType type, int32_t amplitude, int32_t* bufferStart, int
}

int32_t resetterPhaseToMultiply = resetterPhase >> 1;
if ((uint32_t)(resetterPhase) >= (uint32_t) - (resetterPhaseIncrement >> 1)) {
if ((uint32_t)(resetterPhase) >= (uint32_t)-(resetterPhaseIncrement >> 1)) {
resetterPhaseToMultiply -= ((uint32_t)1 << 31); // Count the last little bit of the cycle as
// actually a negative-number bit of the next one.
}
Expand Down
2 changes: 1 addition & 1 deletion src/deluge/model/voice/voice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1831,7 +1831,7 @@ void Voice::renderFMWithFeedbackAdd(int32_t* bufferStart, int32_t numSamples, in
// version. The hard clipping one sounds really solid.
feedback = signed_saturate<22>(feedback);

uint32_t sum = (uint32_t) * (fmSample++) + (uint32_t)feedback;
uint32_t sum = (uint32_t)*(fmSample++) + (uint32_t)feedback;

feedbackValue = dsp::SineOsc::doFMNew(phaseNow += phaseIncrement, sum);
*thisSample = multiply_accumulate_32x32_rshift32_rounded(*thisSample, feedbackValue, amplitudeNow);
Expand Down

0 comments on commit f70949c

Please sign in to comment.