Clang and llc with --x86-asm-syntax=intel produce AT&T syntax - clang

Below are two command line strings I used to output to assembly language listing using --x86-asm-syntax=intel. Both command line strings work, but they both produce AT&T syntax, not Intel syntax.
sudo clang-8 -S -mllvm --x86-asm-syntax=intel Svx.c
sudo llc-8 --x86-asm-syntax=intel Svx.ll -o Svx.s
at the top of each file it says:
.intel_syntax noprefix
But the code it produces is AT&T syntax.
I've researched and haven't found an answer.
Thanks for any ideas on why these command strings do not produce Intel syntax.

Related

Python Getting a SyntaxError: parsing command to Hython on windows

I'm trying to parse a few commands to Houdini's Python module called Hython.
And I'm doing this through os on windows.
My command looks like this:
command = '''"c:\\Program Files (x86)\\Steam\\steamapps\\common\\Houdini Indie\\bin\\hython.exe" -c \
"import sys; sys.path.append('d:\\Cloud\\OneDrive\\Dokumenter\\GitHub\\tutorialTools\\utils'); \
import houUtils; houUtils.runReduction(\'%s\',\'%s\')"''' % (assetDir, amount)
os.popen(command)
I've tried all the tricks on quotations I could think of, but I'm getting a :
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes
in position 49-50: truncated \uXXXX escape
Any kind of help would be appreciated
First I tried adding to the command by separate lines:
"command +=" but this stopped me quickly.
I've tried doing the initial path with r'c:\...'
The entire problem seems to be connected with writing paths inside a quotation.

Are there any good resources on interpreting the AST output of clang?

I'm trying to make sense of clang's AST output and can't really find any enlightenment on the web.
Yes, there is this page but its content is very limited and I can't really do much with their Doxygen documentation.
Command I'm using to generate the AST is:
$ clang -Xclang -ast-dump=json -fsyntax-only file.c

How do I get clang to dump the AST without color?

Using clang-check to dump a source code's AST, can be done with the following command:
$ clang-check -ast-dump file.c --
However, the output of this command will appear colorful within the terminal.
When I direct the output to a file, I'm stuck with all of the color escape codes:
$ clang-check -ast-dump file.c -- > out.txt
example:
[0;1;32mTranslationUnitDecl[0m[0;33m 0x227c5c0[0m <[0;33m<invalid sloc>[0m> [0;33m<invalid sloc>[0m
[0;34m|-[0m[0;1;32mTypedefDecl[0m[0;33m 0x227cac0[0m <[0;33m<invalid sloc>[0m> [0;33m<invalid sloc>[0m implicit[0;1;36m __int128_t[0m [0;32m'__int128'[0m
[0;34m|-[0m[0;1;32mTypedefDecl[0m[0;33m 0x227cb20[0m <[0;33m<invalid sloc>[0m> [0;33m<invalid sloc>[0m implicit[0;1;36m __uint128_t[0m [0;32m'unsigned __int128'[0m
[0;34m|-[0m[0;1;32mTypedefDecl[0m[0;33m 0x227ce70[0m <[0;33m<invalid sloc>[0m> [0;33m<invalid sloc>[0m implicit[0;1;36m __builtin_va_list[0m [0;32m'__va_list_tag [1]'[0m
...
Is there a flag to disable colors in clang-check?
I tried adding the following flag, but it did not work:
--extra-arg="--no-color-diagnostics"
You are almost correct. Try
$ clang-check -ast-dump test.c --extra-arg="-fno-color-diagnostics" --
Additionally, -fno-diagnostics-color and -fdiagnostics-color=never also seems to work
Reference: http://clang.llvm.org/docs/UsersManual.html#formatting-of-diagnostics

Markdown to PDF using Pandoc since Xetex Deprecation

On my MacBook (OSX Mountain Lion), I used to use this Pandoc command to convert Markdown to PDF:
$ markdown2pdf -N -o pandoc_output.pdf --xetex --toc --template=mytemplate.tex myfile.md
But markdown2pdf no longer works, and --xetex option in markdown2pdf -N -o ../../Desktop/pandoc_output.pdf --xetex --toc --template=mytemplate-headers-garamond_date.tex is deprecated.
If I do this:
$ pandoc -N -o Desktop/pandoc_output.pdf --xetex --toc --template=mytemplate.tex myfile.md
I get this:
pandoc: unrecognized option `--xetex'
But if I take out --xetex and do this:
$ pandoc -N -o Desktop/pandoc_output.pdf --toc --template=mytemplate.tex myfile.md
then I get this:
pandoc: Error producing PDF from TeX source.
! Package hyperref Error: Wrong driver option `xetex',
(hyperref) because XeTeX is not detected.
See the hyperref package documentation for explanation.
Type H <return> for immediate help.
...
l.3925 \ProcessKeyvalOptions{Hyp}
What's the solution?
Try --latex-engine=xelatex instead of --xetex
The prior answers to this question were helpful to me, as I had installed pandoc a couple years ago, but never Tex Live. Consequently I had no idea if I had installed it correctly, so putting in the entire path helped me to see that it was working, as follows:
pandoc --latex-engine=/usr/local/texlive/2012basic/bin/universal-darwin/xelatex
This is the default install location for the BasicTex setup which you download from the Pandoc install page.
I had also forgotten about using pandoc -D Latex >my-latex-template.tex to generate a template. After giving a .tex template instead of my .html one (which caused a 'you don't have BEGIN {' error) , I got .PDF: In other words, the default template worked.
Also, I had inaccurately entered -t pdf (not shown above) to set pdf as an output format, but this was not correct. The output format is Latex, which is then translated to PDF. It is not necessary to specify an output format with the dash -t option.
I hope this record of my minor stumbles saves someone some time.
See the pandoc User's Guide (or man page) for the --latex-engine option.

Filter Doxygen output with grep

I want to filter the doxygen warnings with grep, to supress the undocumented parameter warning for certain parameters. I am trying this:
doxygen doxycfgfile | grep -v "parameter x"
however this seems to have absolutely no effect on the output. Neither the lines containing parameter x are suppressed nor all other lines. The output appears to be exactly the same.
I am using tcsh.
Presumably this is because the undocumented parameter warning messages are being written to standard error (stderr), rather than standard out (stdout). With the pipe (|) you are only piping stdout to grep's input.
You could try doing something like
doxygen doxycfgfile |& grep -v "parameter x"
From the advanced bash scripting guide:
If |& is used, the standard error of command1 is connected to command2's standard input through the pipe; it is shorthand for 2>&1 |.
Note, this was added in Bash 4, so for earlier versions you will have you use 2>&1 | in place of |&.
Alternatively, you could just get rid of the standard error output, using something like
doxygen doxycfgfile 2>/dev/null
This answer on askubuntu was the source for my answer.

Resources