Permalink
Browse files

Unbreak the build by pleasing the C90 Elder Gods, petdance--

  • Loading branch information...
leto committed Mar 6, 2012
1 parent 5c0ae67 commit 5dbcdef936fb690d0fd4bf34d0a7ba886920463c
Showing with 2 additions and 2 deletions.
  1. +2 −2 compilers/opsc/src/Ops/Trans/C.pm
@@ -350,15 +350,15 @@ static int get_op(PARROT_INTERP, ARGIN(const char *name), int full)
static void hop_init(PARROT_INTERP)
{
op_info_t * const info = [[BS]]op_lib.op_info_table;
+ opcode_t i;
/* allocate the storage all in one chunk
* yes, this is profligate, but we can tighten it later */
HOP *hops;
hop_buckets = mem_gc_allocate_n_zeroed_typed(interp, [[BS]]op_lib.op_count * 2, HOP );
- hops = hop_buckets;
+ hops = hop_buckets;
- opcode_t i;
/* store full names */
for (i = 0; i < [[BS]]op_lib.op_count; i++) {

8 comments on commit 5dbcdef

Contributor

petdance replied Mar 9, 2012

That's a mistake on my part, indeed. Mixing code and declarations is bad.

But we're not working entirely on C90 specs. If you run GCC with -pedantic on, there are plenty of other C90 errors in our code that we don't have a problem with.

Is this surprising? Do we think that we will build on any C90 compiler? What C90 compiler did the build break on?

Owner

leto replied Mar 9, 2012

It broke the build on gcc (Ubuntu 4.4.3-4ubuntu5)

Contributor

petdance replied Mar 9, 2012

That's craziness. I'm running GCC as well. Can you point to the failed build? Would love to see what flags it was using.

Contributor

allisonrandal replied Mar 12, 2012

Parrot's coding standard is C89/C90 (effectively the same language), see PDD 07. There are good reasons for defining and keeping coding standards (ease of maintenance, minimizing technical debt, etc...), petdance has given some excellent talks on the subject.

Contributor

Whiteknight replied Mar 12, 2012

Keeping some agreed-upon set of standards is good. Our particular C90 requirement can probably be improved. I would love to bump up to C99 eventually.

Contributor

petdance replied Mar 13, 2012

It turns out that the problem with this was that I was building under g++ and g++ is just fine with declarations after code. I need to make sure that I build under both before committing.

Contributor

allisonrandal replied Mar 13, 2012

C99 is definitely tempting. It's mainly a question of portability, particularly MSVC, which doesn't support the C99 standard (and apparently has no plans to ever).

Contributor

cotto replied Mar 13, 2012

Yeah. msvc is pretty much the only reason we're not coding to a more modern version of C.

Please sign in to comment.