Skip to content

Commit

Permalink
Enable clangd and fix some errors
Browse files Browse the repository at this point in the history
  • Loading branch information
encounter committed Dec 15, 2024
1 parent 5aeeb85 commit 087b932
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 79 deletions.
50 changes: 0 additions & 50 deletions .vscode/c_cpp_properties.json

This file was deleted.

8 changes: 7 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"recommendations": [
"llvm-vs-code-extensions.vscode-clangd",
"ms-python.black-formatter",
"ms-python.flake8",
],
"unwantedRecommendations": [
"ms-vscode.cmake-tools",
"ms-vscode.cpptools-extension-pack",
"ms-vscode.cpptools",
"ms-vscode.makefile-tools"
]
}
24 changes: 13 additions & 11 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
// Use Ctrl+Shift+B to run build tasks.
// Or "Run Build Task" in the Command Palette.
"version": "2.0.0",
"tasks": [
{
"name": "F5 Anything: Custom Command",
"type": "f5anything",
"request": "launch",
"command": "ninja"
}
"label": "ninja",
"type": "shell",
"command": "ninja",
"group": {
"kind": "build",
"isDefault": true
}
},
]
}
}
14 changes: 11 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
{
"[c]": {
"files.encoding": "utf8",
"editor.defaultFormatter": "ms-vscode.cpptools"
"editor.defaultFormatter": "llvm-vs-code-extensions.vscode-clangd"
},
"[cpp]": {
"files.encoding": "utf8",
"editor.defaultFormatter": "ms-vscode.cpptools"
"editor.defaultFormatter": "llvm-vs-code-extensions.vscode-clangd"
},
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
"editor.tabSize": 4,
"files.exclude": {
"**/*.ctx": true
},
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"files.associations": {
".clangd": "yaml",
"*.c.ctx": "c",
"*.ctx": "cpp",
"*.cp": "cpp",
Expand All @@ -29,5 +35,7 @@
"rate.h": "c",
"hw_regs.h": "c",
"pikibgm.h": "c"
}
},
// Disable C/C++ IntelliSense, use clangd instead
"C_Cpp.intelliSenseEngine": "disabled",
}
6 changes: 3 additions & 3 deletions include/DebugLog.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
#define PRINT(...) (__VA_ARGS__)
#define ERROR(...) (__VA_ARGS__)
#else
#define PRINT(fmt, ...) _Print(fmt, __VA_ARGS__)
#define ERROR(fmt, ...) _Error(fmt, __VA_ARGS__)
#define PRINT(fmt, ...) _Print(fmt __VA_OPT__(,) __VA_ARGS__)
#define ERROR(fmt, ...) _Error(fmt __VA_OPT__(,) __VA_ARGS__)
#endif

#endif // _DEBUGLOG_H
#endif // _DEBUGLOG_H
3 changes: 0 additions & 3 deletions include/Light.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,6 @@ struct LightGroup : public CoreNode {
void ageDel(struct AgeServer&);

virtual void genAge(class AgeServer&);

void addLight(struct Vector3f&, f32);
void saveini(char*, struct RandomAccessStream&);
#endif

void loadini(CmdStream*);
Expand Down
6 changes: 2 additions & 4 deletions include/stl/stdarg.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,13 @@ void* __va_arg(va_list v_list, u8 type);
#define va_arg(ap, t) (*((t*)__va_arg(ap, _var_arg_typeof(t))))
#define va_end(ap) (void)0

#else
#ifdef __GNUC__
#elif defined(__GNUC__)
typedef __builtin_va_list va_list;
#define va_start(v, l) __builtin_va_start(v, l)
#define va_end(v) __builtin_va_end(v)
#define va_arg(v, l) __builtin_va_arg(v, l)
#endif
#else
typedef char* va_list;

#define _INTSIZEOF(n) ((sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1))
#define va_start(ap, v) (ap = (va_list) & v + _INTSIZEOF(v))
#define va_arg(ap, t) (*(t*)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)))
Expand Down
6 changes: 6 additions & 0 deletions include/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,10 @@ typedef unsigned long size_t;
#define ASM
#endif

// Disable some clangd warnings
#ifdef __clang__
// Allow string literals to be converted to char*
#pragma clang diagnostic ignored "-Wc++11-compat-deprecated-writable-strings"
#endif

#endif // _TYPES_H
20 changes: 16 additions & 4 deletions src/plugPikiColin/animMgr.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "Animator.h"
#include "Ayu.h"
#include "Parameters.h"
#include "String.h"
#include "string.h"
#include "stl/string.h"
#include "Shape.h"
#include "system.h"
Expand Down Expand Up @@ -1186,18 +1186,30 @@ void Animator::changeContext(AnimContext* context) { mContext = context; }
* Address: 80051460
* Size: 000008
*/
int Parm<String>::size() { return sizeof(String); }
template <>
int Parm<String>::size()
{
return sizeof(String);
}

/*
* --INFO--
* Address: 80051468
* Size: 000008
*/
int Parm<f32>::size() { return sizeof(f32); }
template <>
int Parm<f32>::size()
{
return sizeof(f32);
}

/*
* --INFO--
* Address: 80051470
* Size: 000008
*/
int Parm<int>::size() { return sizeof(int); }
template <>
int Parm<int>::size()
{
return sizeof(int);
}

0 comments on commit 087b932

Please sign in to comment.