Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add function prototypes and attributes for better optimization #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
168 changes: 84 additions & 84 deletions include/sacproto.h

Large diffs are not rendered by default.

28 changes: 27 additions & 1 deletion include/sacsys.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ typedef int Word;
#define LARGE 2000
#define SMALL 50


/* Does the compiler support function prototypes? */
#ifdef __STDC__
#define P__(A) A
Expand All @@ -52,6 +51,33 @@ typedef int Word;
# endif
#endif

/* Indicate that an ELF symbol is weak. */
#ifndef __weak
# ifdef __GNUC__
# define __weak __attribute__ ((weak))
# else
# define __weak
# endif
#endif

/* Mark functions that have no side effects and read only their parameters. */
#ifndef __constfunc
# ifdef __GNUC__
# define __constfunc __attribute__ ((const))
# else
# define __constfunc
# endif
#endif

/* Mark functions that have no side effects and read only their parameters and
* global variables. */
#ifndef __pure
# ifdef __GNUC__
# define __pure __attribute__ ((pure))
# else
# define __pure
# endif
#endif


#endif
2 changes: 1 addition & 1 deletion src/AICOMP.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Output
#include "saclib.h"

BDigit AICOMP(A,B)
BDigit *A,*B;
const BDigit *A,*B;
{
BDigit d,i,m,n,s,t,u;

Expand Down
4 changes: 2 additions & 2 deletions src/AICOPY.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ Effect
#include "saclib.h"

void AICOPY(A,B)

BDigit *A,*B;
const BDigit *A;
BDigit *B;
{
BDigit i,n;

Expand Down
3 changes: 2 additions & 1 deletion src/AITRS.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ Output
#include "saclib.h"

BDigit AITRS(A,n,k)
BDigit *A,n,k;
const BDigit *A;
BDigit n,k;
{
BDigit a,b,c,d,h,p;;

Expand Down
2 changes: 1 addition & 1 deletion src/AIZERO.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Output
#include "saclib.h"

BDigit AIZERO(A)
BDigit *A;
const BDigit *A;
{
BDigit t;

Expand Down
3 changes: 2 additions & 1 deletion src/CSFAM.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ Output
#include "saclib.h"

BDigit CSFAM(n,A)
BDigit n,*A;
BDigit n;
const BDigit *A;
{
BDigit c,i;

Expand Down
2 changes: 1 addition & 1 deletion src/FCOMP.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Output
#include "saclib.h"

BDigit FCOMP(I,J)
BDigit *I,*J;
const BDigit *I,*J;
{
BDigit i,p,s;

Expand Down
2 changes: 1 addition & 1 deletion src/HIPSV.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Output

Word HIPSV(n,A)
BDigit n;
interval *A;
const interval *A;
{
BDigit h,i,k,s,t,v;

Expand Down
3 changes: 2 additions & 1 deletion src/IHDREM.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ Output
#include "saclib.h"

Word IHDREM(A,n,b)
Word *A,n,b;
const Word *A;
Word n,b;
{
Word a0,a1,np,r;

Expand Down
3 changes: 2 additions & 1 deletion src/MMAPEVAL.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ Output
#include "saclib.h"

Word MMAPEVAL(m,A,s)
Word m,*A,s;
Word m,s;
const Word *A;
{
Word n,e,i;

Expand Down
2 changes: 1 addition & 1 deletion src/SIPSIZE.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Output
#include "saclib.h"

BDigit SIPSIZE(A)
BDigit *A;
const BDigit *A;
{
BDigit n,p,q1,q2,S;

Expand Down
2 changes: 1 addition & 1 deletion src/SISIGN.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Outputs
#include "saclib.h"

BDigit SISIGN(I)
Word *I;
const Word *I;
{
BDigit p,s,s1,s2;

Expand Down
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Inputs
======================================================================*/
#include "saclib.h"

extern int sacMain P__((int ac, char **av));
extern int sacMain P__((int ac, char **av)) __weak;


void main(argc, argv)
Expand Down