Mantis Bug Tracker

View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000821FirmwareStructure / Stylepublic2013-01-23 22:412014-04-11 11:44
ReporterFred 
Assigned ToFred 
PriorityurgentSeverityminorReproducibilityN/A
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version0.2.0-SNAPSHOT 
Target Version0.2.0Fixed in Version0.2.0 
Summary0000821: Investigate EXTERN extern for functions
DescriptionThis makes sense (at least to me) for vars/structs/etc, but functions remain a mystery. Figure out if it's plain stupid and remove it or document it if not.
TagsNo tags attached.
FirmwareVersionunknown at this time, but current HEAD as of today
Issue TypeTask
Risk of Breakagevery low
Attached Files

- Relationships

-  Notes
User avatar (0002572)
Fred (administrator)
2013-01-23 22:47

That was quick! From wikipedia:

"The extern keyword applied to a function prototype does absolutely nothing (the extern keyword applied to a function definition is, of course, non-sensical). A function prototype is always a declaration and never a definition."

This issue is now to remove extern weirdness from all function declarations.
User avatar (0002768)
Fred (administrator)
2014-04-10 04:15

Potentially partial listing of required changes:

All lines with EXTERN AND with round opening bracket AND WITHOUT const AND WITHOUT square opening bracket:

$ grep -rn EXTERN src/main/ | grep "(" | grep -v const | grep -v "\["
src/main/inc/blockDetailsLookup.h:52:EXTERN unsigned short lookupBlockDetails(unsigned short, blockDetails*) FPAGE_FE;
src/main/inc/commsCore.h:58:EXTERN void decodePacketAndRespond(void) TEXT;
src/main/inc/commsCore.h:60:EXTERN void resetReceiveState(unsigned char) FPAGE_FE;
src/main/inc/commsCore.h:61:EXTERN void finaliseAndSend(unsigned short) FPAGE_FE;
src/main/inc/commsCore.h:63:EXTERN unsigned short populateBasicDatalog(void) FPAGE_FE;
src/main/inc/coreVarsGenerator.h:52:EXTERN void generateCoreVars(void) LOOKUPF;
src/main/inc/decoderInterface.h:353:EXTERN void decoderInitPreliminary(void);
src/main/inc/decoderInterface.h:354:EXTERN void perDecoderReset(void);
src/main/inc/decoderInterface.h:355:EXTERN void resetToNonRunningState(unsigned char uniqueLossID);
src/main/inc/decoderInterface.h:356:EXTERN void schedulePortTPin(unsigned char pin, LongTime timeStamp);
src/main/inc/derivedVarsGenerator.h:52:EXTERN void generateDerivedVars(void) FPAGE_FE;
src/main/inc/flashWrite.h:62:EXTERN unsigned short writeWord(unsigned short*, unsigned short) TEXT;
src/main/inc/flashWrite.h:63:EXTERN unsigned short eraseSector(unsigned char, unsigned short*) TEXT;
src/main/inc/flashWrite.h:64:EXTERN unsigned short writeSector(unsigned char, unsigned short*, unsigned char, unsigned short*) TEXT;
src/main/inc/flashWrite.h:65:EXTERN unsigned short writeBlock(blockDetails*, void*) TEXT;
src/main/inc/fuelAndIgnitionCalcs.h:52:EXTERN void calculateFuelAndIgnition(void) FPAGE_FE;
src/main/inc/outputScheduler.h:52:EXTERN void scheduleOutputs(void) FPAGE_FE;
src/main/inc/simpleGPIO.h:51:EXTERN void performSimpleGPIO(void) FPAGE_FE;
src/main/inc/tableLookup.h:52:EXTERN unsigned short lookupTwoDTableUS(twoDTableUS *, unsigned short) TEXT;
src/main/inc/tableLookup.h:53:EXTERN unsigned short lookupMainTable(unsigned short, unsigned short, unsigned short) TEXT;
src/main/inc/tableLookup.h:56:EXTERN unsigned short validateTwoDTable(twoDTableUS*) TEXT;
src/main/inc/tableLookup.h:57:EXTERN unsigned short validateMainTable(mainTable*) TEXT;
src/main/inc/tableLookup.h:61://EXTERN unsigned short lookup16Bit3dUS(unsigned short*, unsigned short, unsigned short, unsigned short*, unsigned short*, unsigned char, unsigned char); bad wrong.
src/main/inc/tableLookup.h:62://EXTERN unsigned char lookup8Bit2dUC(void);
src/main/inc/tableLookup.h:63://EXTERN unsigned char lookup8Bit3dUC(void);
src/main/inc/tableLookup.h:64://EXTERN signed short lookup16Bit3D(void);
src/main/inc/tableLookup.h:65://EXTERN signed char lookup8Bit3D(void);
src/main/inc/tableLookup.h:66://EXTERN signed short lookup16Bit2D(void);
src/main/inc/tableLookup.h:67://EXTERN signed char lookup8Bit2D(void);
src/main/inc/utils.h:51:EXTERN unsigned short safeAdd(unsigned short, unsigned short);
src/main/inc/utils.h:52:EXTERN unsigned short safeTrim(unsigned short, signed short);
src/main/inc/utils.h:53:EXTERN unsigned short safeScale(unsigned short, unsigned short, unsigned short);
src/main/inc/utils.h:55:EXTERN void sleep(unsigned short) FPAGE_FE;
src/main/inc/utils.h:56:EXTERN void sleepMicro(unsigned short) FPAGE_FE;
src/main/inc/utils.h:58:EXTERN void adjustPWM(void) FPAGE_FE;
src/main/inc/utils.h:59:EXTERN void setupPagedRAM(unsigned char) FPAGE_F8;
src/main/inc/utils.h:61:EXTERN void sampleEachADC(ADCBuffer*) FPAGE_F8;
src/main/inc/utils.h:62:EXTERN void sampleLoopADC(ADCBuffer*) FPAGE_F8;
src/main/inc/utils.h:63://EXTERN void sampleBlockADC(ADCBuffer*) FPAGE_F8; broken, do not use
src/main/inc/utils.h:65:EXTERN unsigned char checksum(unsigned char *, unsigned short) FPAGE_F8;
src/main/inc/utils.h:66:EXTERN unsigned short stringCopy(unsigned char*, unsigned char*) FPAGE_F8;
src/main/inc/utils.h:67:EXTERN unsigned short compare(unsigned char*, unsigned char*, unsigned short); // In unpaged flash as it needs to compare paged flash with unpaged things
src/main/inc/xgateVectors.h:71:extern void xgateSchedule(); // extern not EXTERN because it is defined outside of C
User avatar (0002770)
Fred (administrator)
2014-04-11 11:44

Fixed in 04f26ce AFAICT. If I missed any, feel free to reopen.


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker