The execution of macos – clang (even without arguments) takes 0.7 seconds

$ time nonexistent-command
zsh: command not found: nonexistent-command
nonexistent-command  0.00s user 0.00s system 0% cpu 0.425 total
$ time clang
clang: error: no input files
clang  0.01s user 0.68s system 40% cpu 1.682 total

Since clang is called each time ./configure If you try a C / C ++ snippet, it takes about 5-10 to run configure on a project protocol,

$ time ./configure
(...)
./configure  29.65s user 542.02s system 96% cpu 9:50.57 total

I managed to track this down to a call to fparseln inside the clang binary, but that's it.

Instruments SS:

instrument view

Corresponding assembler inside:

assembler

This problem occurs for me and my staff, but not for others I asked. It happened in both High Sierra and Catalina (I tried upgrading but it didn't fix it).

Everyone on a Mac in my office has this problem, so it may be something that IT installed, but no idea what or how to find it. Ideas how to proceed and / or fix?

clang – ASAN reports no memory leak for the GPtrArray-related functions of glib

I think ASAN reports no memory leak for glibs GPtrArray related functions. For example:

$ cat test_asan.c
#include 
int main()
{
    GPtrArray *gparray = g_ptr_array_new_with_free_func(g_free);

    g_ptr_array_add(gparray, g_strdup("--"));
}

Build and run this file:

$ clang -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -fsanitize=address -g test_asan.c -o test_asan -lglib-2.0
$ ./test_asan
$

Nothing is reported. But in fact the above program forgot to call g_ptr_array_free (gparray, TRUE); At the end of main Function.

Can anyone explain this behavior? Or did I miss something?

18.04 – Installation of Clang on Ubuntu18.04?

I'm trying to install Clang on Ubuntu 18.04. I did the following:

Go to the source of llvm, create a directory and execute the command cmake -DLLVM_ENABLE_PROJECTS = clang -G "Unix Makefiles" ../llvm.

After executing this command when I ran the make command, the following error appeared:

make: *** No targets specified and no makefile found. Stop.

Can someone help me?

c ++ – This is a simple replacement of 64-bit integers on 64-bit ARM using the inline assembly in gcc, but it must be clang

I would like to have an opinion that I found and modified in BDE.

I need the fastest possible 64-bit integer swap. This is for a mobile application that is used by many people. That's why I want to create a template specialization for it (in addition to std :: swap ()) and integrate it into the C ++ standard library for our platform.

I am not sure how to port this to Clang 7. It works well with gcc. Any advice would be appreciated ..

in line
int64_t swapInt64 (int64_t * atomicInt,
int64_t swapValue)
{
int64_t oldValue;
int rc;

// Clang does not support a registry
// pairs representing a 64-bit value. Instead of & dquo; ldrexd% 1,% H1, [%3]& # 39;
// The exact registers must be specified, as in # ldrexd r2, r3, [%3]& # 39 ;.

as fleeting (
"1: ldrexd r2, r3, [%4]            n  t "
"Mov%[old1], r2  n  t "
"Mov%[old2], r3  n  t "
"mov r2,%[val1]             n  t "
"mov r3,%[val2]             n  t "
"Strexd%[rc]r2 r3 [%4]     n  t "
: [rc]   "= & r" (rc),
                  [old1] "= & r" (((Int64_Words &) oldValue) .w1),
                  [old2] "= & r" (((Int64_Words &) oldValue) .w2),
"+ Qo" (* atomicInt)
: "r" (atomic Int),
                  [val1] "r" (((Int64_Words &) swapValue) .w1),
                  [val2] "r" (((Int64_Words &) swapValue) .w2)
: "r2", "r3", "cc", "memory");

return oldValue;
}

Using Clang / LLVM JIT with C ++ object code using STL

I've implemented a simple Clang / LLVM JIT-based C / C ++ "interpretation" that works well (including STL (std :: cout, …), OpenMP, …). I use Clang / LLVM 8 in all my experiments.

Now I want to link JITted code to externally compiled object files (or static library / archive). This also seems to work until the code in the object file contains the use of "iostream" like "std :: cout, …". At this point, it crashes when I try to add the object file to JIT. It does not matter if my object file was compiled with g ++ or clang ++ (the same version as my libLLVM and libClang).

My simplified JIT implementation looks something like this:

- Query the system Triple and create llvm :: Target
- Create clang driver
- Create "Compilation" with the driver
- Go through jobs in the compilation and create "CompilerInvocation"
and running EmitLLVMOnlyAction for each job
- Finally I create "ExecutionEngine" of "EngineKind :: JIT"
and use "addModule" to add all compiled modules
- At this point I add external object file (s) or archive (s)
"addObjectFile" or "addArchive" ** crashes here if object file uses AWL **

It should be noted that I can use things like "std :: vector" in the object files without any problems. Even "printf" seems to work well. Therefore, I suspect that STL's "iostream" requires some global symbols.

Should this configuration work? Suggestions are welcome.

macos – Configure the Compiler Path (Clang) in Visual Studio Code (for Mac OS)

0

I am completely new to C ++ and would like to use this language on a Mac OS with Visual Studio Code Editor. I'm trying to configure the clang compiler under Visual Studio code as described at https://code.visualstudio.com/docs/cpp/config-clang-mac.

However, when I try to do this, configuring the compiler path does not seem to work. In fact, I have two problems:

1- In the command palette, you are prompted to select "Edit configurations" from the list of suggestions. I can not find this proposal. I then decided to click on "C / C ++: Edit configurations (JSON)"

2-If I click on it, an error message will appear in the bottom right corner saying that C-Cpp.ConfigurationEditJson was not found.

It's hard for me to find out what I can do. Can someone please enlighten me? Many Thanks!

xcode – UDUNITS-2 —> clang: Error: no such file or directory: & # 39; _REENTRANT & # 39;

I'm trying to install the UDUNITS 2 graphical visual browser package: ncview. Can anyone help me understand the following error message:

clang: Error: no such file or directory: & # 39; _REENTRANT & # 39;

A similar question has been asked here —> Xcode 7.2 – clang: Error: no such file or directory:

My ./configure Output:

brendan-darrer: Downloads brendandarrer $ cd src /
brendan-darrer: src brendandarrer $ ls
COPYRIGHT INSTALL NOTEBOOK README VERSION admin configure.in perl udunits
CUSTOM Makefile.in ORIGIN RELEASE_NOTES aclocal.m4 configure the lib port
brendan-darrer: src brendandarrer $ ./configure
Create cache ./config.cache
configure: warning: read configuration customizations
Checking the operating system ... Darwin
Check for c89 ... c89
Checking Dependency Generation Mechanism ... c89 -M
Check how the C preprocessor runs ... c89 -E
Checking the C-preprocessor ... works
Check for C const ... yes
Check for volatile C ... yes
Exam for C signed ... yes
Check for C function prototypes ... Yes
Check for standard C variadic functions ... Yes
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c89: invalid option - M
Usage: c89 [-cEgs] [-D name[=value]] [-I directory] ... [-L directory] ...
       [-o outfile] [-O optlevel] [-U name]... operand ...
Check for standard C string generation ... Yes
Check for standard C token insertion ... Yes
Verification of invalid pointer ... yes
Checking the machine type ... x86_64
check for ar ... ar
check for tar flags ... -chof
looking for ranlib ... ranlib
check binary distribution directory ... / home / ftp / pub / binary / x86_64-darwin
Check installation prefix ... / user / burner / downloads
Check the installation Exec prefix ... / Users / brendandarrer / Downloads / bin
to neqn check ... neqn
to test on tbl ... tbl
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c89: invalid option - M
Usage: c89 [-cEgs] [-D name[=value]] [-I directory] ... [-L directory] ...
       [-o outfile] [-O optlevel] [-U name]... operand ...
Check C header file  declared for typedef size_t ...
Check for ar ... (cached) ar
check for float.h ... yes
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c89: invalid option - M
Usage: c89 [-cEgs] [-D name[=value]] [-I directory] ... [-L directory] ...
       [-o outfile] [-O optlevel] [-U name]... operand ...
Check C header file  declared for typedef size_t ...
check atexit ... yes
Check C header file  for function atexit () ... declared
to check on getenv ... yes
Check C header file  declared for the function getenv () ...
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c89: invalid option - M
Usage: c89 [-cEgs] [-D name[=value]] [-I directory] ... [-L directory] ...
       [-o outfile] [-O optlevel] [-U name]... operand ...
Check C header file  declared for typedef size_t ...
looking for strerror ... yes
Check C header file  for the function strerror () ... declared
looking for strstr ... yes
Check C header file  for the function strstr () ... declared
looking for memmove ... yes
Check C header file  declared for the memmove () ... function
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c89: invalid option - M
Usage: c89 [-cEgs] [-D name[=value]] [-I directory] ... [-L directory] ...
       [-o outfile] [-O optlevel] [-U name]... operand ...
Check C header file  declared for typedef time_t ...
Check C header file  declared for typedef size_t ...
Check for time ... yes
Check C header file  for function difftime () ... declared
Check for strict time ... yes
Check C header file  for the function strftime () ... declared
Check for Perl ... Perl
Check if an executable Perl file should be created ... dynamically
Check for position independent compilation flags ... & # 39; & # 39;
Cache is updated ./config.cache
Create ./config.status
Make a Makefile
Create lib / Makefile
Create files / Makefile
Creating Perl / Makefile.PL
create port / master.mk
Create a port / makefile
create port / misc / makefile
Create Port / Fortc / Makefile
create port / misc / udposix.h
create port / misc / stdarg.h
create port / misc / stddef.h
create port / misc / stdlib.h
create port / misc / string.h
create port / misc / time.h
Expand "include & # 39; s" in the Makefile file
Extending "include & # 39; s" in the file "lib / Makefile"
Extending "include & # 39; s" in the "udunits / Makefile" file
Extending "include & # 39; s" in the perl / Makefile.PL file
Extending include & # 39; s in the port / master.mk file
Extending include & # 39; s in the port / Makefile file
Extend include & # 39; s in the port / misc / Makefile file
Extending include & # 39; s in the port / fortc / Makefile file
brendan-darrer: src brendandarrer $ make
Makefile: 279: Warning: Commands for target `/ Users / brendandarrer / Downloads / lib & # 39; override
Makefile: 276: Warning: Ignore old commands for target `/ Users / brendandarrer / Downloads / lib & # 39 ;.
Makefile: 384: Warning: commands for target `/ Users / brendandarrer / downloads / bin & # 39; override
Makefile: 381: Warning: Ignore old commands for target `/ Users / brendandarrer / Downloads / bin & # 39 ;.
Makefile: 418: Warning: Commands for target `/ Users / brendandarrer / Downloads / include & # 39; override
Makefile: 415: Warning: Ignore old commands for target `/ Users / brendandarrer / Downloads / include & # 39 ;.
Makefile: 448: Warning: Override commands for target `/ Users / brendandarrer / Downloads / etc
Makefile: 445: Warning: Ignore old commands for target `/ Users / brendandarrer / Downloads / etc & # 39 ;.
Makefile: 503: Warning: Commands for target `/ Users / brendandarrer / Downloads / man & # 39; override
Makefile: 491: Warning: Ignore old commands for target `/ Users / brendandarrer / Downloads / man & # 39 ;.
Makefile: 541: Warning: Commands for target `/ Users / brendandarrer / Downloads / info & # 39; override
Makefile: 538: Warning: Ignore old commands for target `/ Users / brendandarrer / Downloads / info & # 39 ;.

`all & # 39; in the directory / Users / brendandarrer / Downloads / src / port

Makefile: 263: Warning: Commands for target `/ Users / brendandarrer / Downloads / lib & # 39; override
Makefile: 260: Warning: Ignore old commands for target `/ Users / brendandarrer / Downloads / lib & # 39 ;.
Makefile: 368: Warning: Commands for destination `/ Users / brendandarrer / Downloads / bin & # 39; override
Makefile: 365: Warning: Ignore old commands for target `/ Users / brendandarrer / Downloads / bin & # 39 ;.
Makefile: 402: Warning: Commands for target `/ Users / brendandarrer / Downloads / include & # 39; override
Makefile: 399: Warning: Ignore old commands for target `/ Users / brendandarrer / Downloads / include & # 39 ;.
Makefile: 432: Warning: Override commands for target `/ Users / brendandarrer / Downloads / etc
Makefile: 429: Warning: Ignore old commands for target `/ Users / brendandarrer / Downloads / etc
Makefile: 487: Warning: Commands for target `/ users / brendandarrer / downloads / man & # 39; override
Makefile: 475: Warning: Ignore old commands for target `/ Users / brendandarrer / Downloads / man & # 39 ;.
Makefile: 525: Warning: Commands for target `/ Users / brendandarrer / Downloads / info & # 39; override
Makefile: 522: Warning: Ignore old commands for target `/ Users / brendandarrer / Downloads / info & # 39 ;.
Makefile: 263: Warning: Commands for target `/ Users / brendandarrer / Downloads / lib & # 39; override
Makefile: 260: Warning: Ignore old commands for target `/ Users / brendandarrer / Downloads / lib & # 39 ;.
Makefile: 368: Warning: Commands for destination `/ Users / brendandarrer / Downloads / bin & # 39; override
Makefile: 365: Warning: Ignore old commands for target `/ Users / brendandarrer / Downloads / bin & # 39 ;.
Makefile: 402: Warning: Commands for target `/ Users / brendandarrer / Downloads / include & # 39; override
Makefile: 399: Warning: Ignore old commands for target `/ Users / brendandarrer / Downloads / include & # 39 ;.
Makefile: 432: Warning: Override commands for target `/ Users / brendandarrer / Downloads / etc
Makefile: 429: Warning: Ignore old commands for target `/ Users / brendandarrer / Downloads / etc
Makefile: 487: Warning: Commands for target `/ users / brendandarrer / downloads / man & # 39; override
Makefile: 475: Warning: Ignore old commands for target `/ Users / brendandarrer / Downloads / man & # 39 ;.
Makefile: 525: Warning: Commands for target `/ Users / brendandarrer / Downloads / info & # 39; override
Makefile: 522: Warning: Ignore old commands for target `/ Users / brendandarrer / Downloads / info & # 39 ;.

`all & # 39; in the directory / Users / brendandarrer / Downloads / src / port / misc

Makefile: 285: Warning: Commands for target `/ Users / brendandarrer / Downloads / lib & # 39; override
Makefile: 282: Warning: Ignore old commands for target `/ Users / brendandarrer / Downloads / lib & # 39;
Makefile: 390: Warning: Commands for target `/ Users / brendandarrer / downloads / bin & # 39; override
Makefile: 387: Warning: Ignore old commands for target `/ Users / brendandarrer / Downloads / bin & # 39 ;.
Makefile: 424: Warning: Commands for target `/ Users / brendandarrer / Downloads / include & # 39; override
Makefile: 421: Warning: Ignore old commands for target `/ Users / brendandarrer / Downloads / include & # 39 ;.
Makefile: 454: Warning: Override commands for target `/ Users / brendandarrer / Downloads / etc
Makefile: 451: Warning: Ignore old commands for target `/ Users / brendandarrer / Downloads / etc & # 39 ;.
Makefile: 509: Warning: commands for target `/ users / brendandarrer / downloads / man & # 39; override
Makefile: 497: Warning: Ignore old commands for target `/ Users / brendandarrer / Downloads / man & # 39 ;.
Makefile: 547: Warning: Commands for target `/ Users / brendandarrer / Downloads / info & # 39; override
Makefile: 544: Warning: Ignore old commands for target `/ Users / brendandarrer / Downloads / info & # 39 ;.
c89 -c -g -I. -D_REENTRANT uddummy.c
clang: Error: no such file or directory: & # 39; _REENTRANT & # 39;
do[3]: *** [uddummy.o] Error 1
do[2]: *** [misc/all] Error 1
do[1]: *** [subdirs/all] Error 2
do: *** [port/all] Error 1
brendan-darrer: src brendandarrer $ 

GCC or Clang to output bytecode for a VM?

To make it short: I wanted to use C as a scripting language and in a portable way, so I developed a register-based, JITless VM to accomplish this.

I formalized the ISA of the VM, the script file format, the calling conventions, and even created an assembler that converts the user-readable bytecode into a numeric bytecode. Now I need a compiler to target my VM.

I was wondering if I should create a GCC or an LLVM backend to accomplish this, but I've done such a project before. Should I create a GCC backend or LLVM backend, or are additional options available?

c ++ 11 – Unexpected clang transformation warning when arithmetically adding unsigned shorts (C ++ 11)

I have code for which I would have expected no warning, and I wonder if there are some key conversion methods that I have overlooked or misunderstood.

Here is my code:

unsigned short totalMinutes = firstPtr-> minutes + secondPtr-> minutes;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I can tell you that the firstPtr and secondPtr protocol is also defined as unsigned shorts.

However, I'm getting a wconversion error in this line of code that states:

Error: implicit conversion loses integer precision: & # 39; int & # 39; in & unsigned short & # 39; [-Werror,-Wconversion]

Is there an implicit casting that occurs in the arithmetic of unsigned tokens / characters / characters?