<< Back to previous view

[PCC-175] pcc has problems with extern inline Created: 30/Oct/10  Updated: 30/Oct/10

Status: Closed
Project: pcc
Component/s: C frontend
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Daniel Dickman Assignee: Anders Magnusson
Resolution: Fixed Votes: 0
Environment: OpenBSD 4.8-current (GENERIC) #308: Fri Oct 29 12:55:14 MDT 2010

pcc 0.9.9 for x86_64-unknown-openbsd4.8, xxx@xxx.xxx.xxx Sat Oct 30 12:49:53 EDT 2010

gcc (GCC) 4.2.1 20070719

latest pcc seems to choke on "extern inline". But this works on gcc. I'm not sure what the official spec says should happen here. Here's a test case --

---[ func.h ]---------------------------------
#ifndef FUNC_H
#define FUNC_H

#include <stdio.h>

extern inline int some_function();

extern inline int some_function()
        printf("extern some_function\n");
        return 0;


---[ func.c ]---------------------------------
#include "func.h"

int some_function()
        return 0;

int main(int argc, char** argv) {
        return some_function();
---[ pcc func.c ]---------------------------------
func.c, line 4: redeclaration of some_function

---[ gcc func.c ]---------------------------------

---[ output of running ./a.out which was compiled with gcc ]---------------------------------

Comment by Anders Magnusson [ 30/Oct/10 10:31 PM ]
This behavior is as it is intended to. Note that gcc do not follow C99 specifications when it comes to inline:

- In C99 declaration of "extern inline" will create a function with external linkage (i.e. a normal function).
- In gcc "extern inline" will make a function that is only inlined, no external linkage.

Pcc follows C99 strictly, but accept the gcc compat attribute gnu_inline which tells that an inline function shall obey gcc syntax.
Also, the define __GNUC_STDC_INLINE__ can be checked whether the inlining is c99 or gcc.

In newer gcc using -std=c99 will make it use c99 syntax. It's not default though.
Generated at Thu Mar 23 23:16:20 CET 2017 using JIRA Enterprise Edition, Version: 3.13.1-#333.