[cfe-users] Question about libclang 4.0/3.9 compatibility.

2018-11-25 Thread Devin Hussey via cfe-users
I am trying to make https://github.com/AnacondaRecipes/c99-to-c89
(obviously a c99 to c89 converter) work with newer Clang versions.

I mainly want to use it so we can use full C99 features with an old
version of gcc (2.95), which we are stuck with for a project.

Something between 3.9 and 4.0 broke the program, and when it tries to
convert compound literals, it fails to place braces properly.
I was unable to find anything on an api change in the changelogs, and
manually fiddling with the code was only helping a little bit, and I
feel that I am just going to break something.

Code to convert:
extern void foo(int[]);
void bar(void)
{
 foo((int []) { 1, 2, 3 });
}

Expected output (from clang 3.9):
extern void foo(int[]);
void bar(void)
{
 {   int tmp__0 [] =   { 1, 2, 3 }; foo(tmp__0   ); }
}

or, formatted,
extern void foo(int[]);
void bar(void)
{
{
int tmp__0[] = { 1, 2, 3 };
foo(tmp__0);
}
}

Actual output (from clang versions 4-7, all the same output):
extern void foo(int[]);
void bar(void)
{
 {   int tmp__0 [] =   { 1, 2, 3; foo(tmp__0  } });
}

or, formatted,
extern void foo(int[]);
void bar(void)
{
{
int tmp__0[] = { 1, 2, 3;
foo(tmp__0
}
});
}

Note the lack of closing braces on the initializer list and the two
closing braces in the parentheses.

Everything else seems to work fine.

For the output of the first unit test, I have it on this gist:
https://gist.github.com/easyaspi314/f38b379e2af2fe27d1014c2b3010f914

Can someone help me with this?
___
cfe-users mailing list
cfe-users@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users


[cfe-users] Power9 and __builtin_byte_in_range

2018-11-25 Thread Jeffrey Walton via cfe-users
I'm trying to compile a Power9 program with Clang 7.0:

$ $HOME/llvm/bin/clang++  -mcpu=power9 -maltivec
TestPrograms/test_ppc_power9.cxx
TestPrograms/test_ppc_power9.cxx:6:11: error: use of undeclared identifier
  '__builtin_byte_in_range'
bool x = __builtin_byte_in_range(b, r);
 ^
1 error generated.

I'm not sure if Clang 7.0 uses another builtin, or if Clang does not
support Power9.

I guess I have one of two questions:

  1. What is LLVM's name for __builtin_byte_in_range?

  2. Which Clang compilers support Power9?

Jeff
___
cfe-users mailing list
cfe-users@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users