alliedmodders / sourcepawn

A small, statically typed scripting language.
Other
366 stars 62 forks source link

Assembler output switch option is unrecognized #715

Open JoinedSenses opened 2 years ago

JoinedSenses commented 2 years ago

Latest spcomp 1.11 6820 Adding -a option produces output: error: Unrecognized option: -a

image

JoinedSenses commented 2 years ago

Additionally, output does not include all available options like 1.10 does. image

Fyren commented 2 years ago

-a and -l were removed. For now, your easiest option for disassembly is using the disassembler in the tools directory of this repo. There isn't currently a way to do only preprocessing.

asherkin commented 2 years ago

-h with no input files shows the full help output.

dvander commented 2 years ago

Reason for -l removal: My viewpoint toward macros is that they're a part of the language, and should be part of the normal language pipeline. It's different from C/C++ where macros are a separate language with a distinct preprocessor. It's not that decoupling them is bad, it's just not something I want to have to think about. Especially given the complexities around static scopes in Pawn (which are per-file, not per-translation-unit), our preprocessor needs tight semantic integration. And therefore "-l" would have to inject lots of weird tokens into the listing to make the output actually compilable.

The best way to debug macros is to not use them. Failing that, to not make them complicated.

Reason for -a removal: This one is a loss that I just don't have time to add back, given that smxtools exists. The original spcomp followed a GCC model of producing a text-based assembly stream, and then having a separate component which could parse and assemble the stream. It was a real pain to extend and debug, and it was slow. It's optimizing for the worst case (you want to debug a compiler bug). Given that we want servers to run .sp files directly in the near future, having this additional step makes no sense.

That said, it is now legitimately a pain to debug assembly errors. I do most of my development on WSL2. I wind up building the binary, opening Visual Studio, running smxtools, then navigating to the .smx path. There's no CLI version of the tool, because fool me made the entire thing very GUI centric, and it's pointless to refactor it without rewriting it.

The problem will get worse when we move to source-only and stop emitting .smx files in newer compilers. I'm still gaming out how to approach this. It's been a long time since I worked on compilers in a professional capacity and I can't remember how we used to do this for JavaScript engines.

JoinedSenses commented 2 years ago

Fair enough. Would it make sense then to modify the output for these options to mention its intentional removal?

dvander commented 2 years ago

Yeah, that's a good idea.