An optimization/improvement from our old way of providing
MPI::SEEK_SET and friends, suggested by Doug Gregor. This way allows users to utilize SEEK_SET in a case statement, which they could not do with our previous method. This commit was SVN r19494.
Этот коммит содержится в:
родитель
21910d29ff
Коммит
46da10ff08
@ -18,14 +18,10 @@
|
|||||||
//
|
//
|
||||||
// $HEADER$
|
// $HEADER$
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
static const int ompi_stdio_seek_set = SEEK_SET;
|
|
||||||
static const int ompi_stdio_seek_cur = SEEK_CUR;
|
|
||||||
static const int ompi_stdio_seek_end = SEEK_END;
|
|
||||||
|
|
||||||
#include "mpicxx.h"
|
#include "mpicxx.h"
|
||||||
|
|
||||||
/* Need to include ompi_config.h after mpicxx.h... */
|
/* Need to include ompi_config.h after mpicxx.h so that we get
|
||||||
|
SEEK_SET and friends right */
|
||||||
#include "ompi_config.h"
|
#include "ompi_config.h"
|
||||||
|
|
||||||
#if OMPI_CXX_USE_PRAGMA_IDENT
|
#if OMPI_CXX_USE_PRAGMA_IDENT
|
||||||
@ -39,13 +35,6 @@ namespace MPI {
|
|||||||
|
|
||||||
#include "ompi/errhandler/errhandler.h"
|
#include "ompi/errhandler/errhandler.h"
|
||||||
|
|
||||||
#if OMPI_PROVIDE_MPI_FILE_INTERFACE && OMPI_WANT_MPI_CXX_SEEK
|
|
||||||
|
|
||||||
const int SEEK_SET = ompi_stdio_seek_set;
|
|
||||||
const int SEEK_CUR = ompi_stdio_seek_cur;
|
|
||||||
const int SEEK_END = ompi_stdio_seek_end;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace MPI {
|
namespace MPI {
|
||||||
|
|
||||||
#if ! OMPI_HAVE_CXX_EXCEPTION_SUPPORT
|
#if ! OMPI_HAVE_CXX_EXCEPTION_SUPPORT
|
||||||
|
@ -49,6 +49,10 @@
|
|||||||
// a #define (it's used in an enum).
|
// a #define (it's used in an enum).
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
static const int ompi_stdio_seek_set = SEEK_SET;
|
||||||
|
static const int ompi_stdio_seek_cur = SEEK_CUR;
|
||||||
|
static const int ompi_stdio_seek_end = SEEK_END;
|
||||||
|
|
||||||
// smash SEEK_* #defines
|
// smash SEEK_* #defines
|
||||||
#ifdef SEEK_SET
|
#ifdef SEEK_SET
|
||||||
#undef SEEK_SET
|
#undef SEEK_SET
|
||||||
@ -57,9 +61,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// make globally scoped constants to replace smashed #defines
|
// make globally scoped constants to replace smashed #defines
|
||||||
extern const int SEEK_SET;
|
static const int SEEK_SET = ompi_stdio_seek_set;
|
||||||
extern const int SEEK_CUR;
|
static const int SEEK_CUR = ompi_stdio_seek_cur;
|
||||||
extern const int SEEK_END;
|
static const int SEEK_END = ompi_stdio_seek_end;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// forward declare so that we can still do inlining
|
// forward declare so that we can still do inlining
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user