Skip to content

Commit

Permalink
Unbreak the build by pleasing the C90 Elder Gods, petdance--
Browse files Browse the repository at this point in the history
  • Loading branch information
leto committed Mar 6, 2012
1 parent 5c0ae67 commit 5dbcdef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compilers/opsc/src/Ops/Trans/C.pm
Expand Up @@ -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++) {
Expand Down

8 comments on commit 5dbcdef

@petdance
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@leto
Copy link
Member Author

@leto leto commented on 5dbcdef Mar 9, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@petdance
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@allisonrandal
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Whiteknight
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@petdance
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@allisonrandal
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

@cotto
Copy link
Contributor

@cotto cotto commented on 5dbcdef Mar 13, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Please sign in to comment.